Dim varselected As Variant
Dim strSQL As String
For Each varselected In Me.programvalue.ItemsSelected
strSQL = strSQL & "'" & Me.programvalue.ItemData
(varselected) & "',"
If strSQL <> "" Then
strSQL = "[obligation] IN (" & Left(strSQL, Len
(strSQL) - 0) & ")"
Me.looktest = DSum("Allocation", "Program",
When I added the following, I get an error that says that
the object doesn't contain the Automation object 'strSQL':
Me.looktest2 = Nz(DSum
("[VouchAmt]", "FY02_BASETABLE", "strSQL and datepart('m',
[Start Date])= 10 and [FY] = [forms]![password]![FY]"), 0)
I suppose it has something to do with the additional
criteria along with the strSQL. How can I resolve this?
Is my syntax wrong? Because Me.looktest = DSum
("Allocation", "Program", strSQL) works. But in this
case the DSum is much more complex.
Teresely, I want to add the dynamic strSQL filter to the DSum criteria. What is the best way to do this?