G
geebee
Hi,
I have the following in my form:
Dim varselected As Variant
Dim strSQL As String
For Each varselected In Me.programvalue.ItemsSelected
strSQL = strSQL & "'" & Me.programvalue.ItemData
(varselected) & "',"
Next varselected
If strSQL <> "" Then
strSQL = "[obligation] IN (" & Left(strSQL, Len
(strSQL) - 0) & ")"
With CodeContextObject
Me.looktest = DSum("Allocation", "Program",
strSQL)
End With
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.
Thanks in advance,
geebee
I have the following in my form:
Dim varselected As Variant
Dim strSQL As String
For Each varselected In Me.programvalue.ItemsSelected
strSQL = strSQL & "'" & Me.programvalue.ItemData
(varselected) & "',"
Next varselected
If strSQL <> "" Then
strSQL = "[obligation] IN (" & Left(strSQL, Len
(strSQL) - 0) & ")"
With CodeContextObject
Me.looktest = DSum("Allocation", "Program",
strSQL)
End With
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.
Thanks in advance,
geebee