S
saraqpost
Set rst = "SELECT tblActData.Dept, tblActData.Amount,
tblActData.COAKey, tlkpCOA.Number, " _
& " tlkpCOA.Account, tblActData.Subsidiary,
tblActData.FiscalYr, " _
& " tblActData.FiscalMonth, " _
& " #" & "DateSerial([tblActData.FiscalYr],
[tblActData.FiscalMonth],1) # " _
& " FROM tblActData INNER JOIN tlkpCOA ON tblActData.COAKey =
tlkpCOA.COAKey " _
& " WHERE tblActData.COAKey = " & lngCOAKey _
& " AND tblActData.Subsidiary = '" & strSubsidiary & "'" _
& " AND #(DateSerial([tblActData.FiscalYr],
[tblActData.FiscalMonth], 1) #" _
& " Between DateAdd " & "('m', -12," & "#" & dtmEndDate & "#)"
_
& " And #" & dtmEndDate & "#" _
& " ORDER BY tblActData.Dept, tblActData.FiscalYr,
tblActData.FiscalMonth;"
I'm trying to use the above code to count the records so if there are
no matches with the criteria, I do not show the listbox, but tell the
user, instead.
The code gives me "424 - Object Required" message. And in the
Immediate Window I see rst = Nothing,
I struggled to get the code above to display - the # around the dates
was challenging, but I put the above in a strSQL and it looked ok (but
obviously is not). When I put the same code into set rst, I get the
message.
strSQL: (immediate window)
SELECT tblActData.Dept, tblActData.Amount, tblActData.COAKey,
tlkpCOA.Number, tlkpCOA.Account, tblActData.Subsidiary,
tblActData.FiscalYr, tblActData.FiscalMonth, #DateSerial
([tblActData.FiscalYr],[tblActData.FiscalMonth],1) # FROM tblActData
INNER JOIN tlkpCOA ON tblActData.COAKey = tlkpCOA.COAKey WHERE
tblActData.COAKey = 433 AND tblActData.Subsidiary = 'Parent Company'
AND #(DateSerial([tblActData.FiscalYr], [tblActData.FiscalMonth], 1) #
Between DateAdd ('m', -12,#6/1/2010#) And #6/1/2010# ORDER BY
tblActData.Dept, tblActData.FiscalYr, tblActData.FiscalMonth;
Can anyone help?
Thanks in advance -
Sara
tblActData.COAKey, tlkpCOA.Number, " _
& " tlkpCOA.Account, tblActData.Subsidiary,
tblActData.FiscalYr, " _
& " tblActData.FiscalMonth, " _
& " #" & "DateSerial([tblActData.FiscalYr],
[tblActData.FiscalMonth],1) # " _
& " FROM tblActData INNER JOIN tlkpCOA ON tblActData.COAKey =
tlkpCOA.COAKey " _
& " WHERE tblActData.COAKey = " & lngCOAKey _
& " AND tblActData.Subsidiary = '" & strSubsidiary & "'" _
& " AND #(DateSerial([tblActData.FiscalYr],
[tblActData.FiscalMonth], 1) #" _
& " Between DateAdd " & "('m', -12," & "#" & dtmEndDate & "#)"
_
& " And #" & dtmEndDate & "#" _
& " ORDER BY tblActData.Dept, tblActData.FiscalYr,
tblActData.FiscalMonth;"
I'm trying to use the above code to count the records so if there are
no matches with the criteria, I do not show the listbox, but tell the
user, instead.
The code gives me "424 - Object Required" message. And in the
Immediate Window I see rst = Nothing,
I struggled to get the code above to display - the # around the dates
was challenging, but I put the above in a strSQL and it looked ok (but
obviously is not). When I put the same code into set rst, I get the
message.
strSQL: (immediate window)
SELECT tblActData.Dept, tblActData.Amount, tblActData.COAKey,
tlkpCOA.Number, tlkpCOA.Account, tblActData.Subsidiary,
tblActData.FiscalYr, tblActData.FiscalMonth, #DateSerial
([tblActData.FiscalYr],[tblActData.FiscalMonth],1) # FROM tblActData
INNER JOIN tlkpCOA ON tblActData.COAKey = tlkpCOA.COAKey WHERE
tblActData.COAKey = 433 AND tblActData.Subsidiary = 'Parent Company'
AND #(DateSerial([tblActData.FiscalYr], [tblActData.FiscalMonth], 1) #
Between DateAdd ('m', -12,#6/1/2010#) And #6/1/2010# ORDER BY
tblActData.Dept, tblActData.FiscalYr, tblActData.FiscalMonth;
Can anyone help?
Thanks in advance -
Sara