Reputation: 23
I need some help. When i run the below query I get no results back if i include the Pkg number part of the where. When i run the query in Access it works fine. example of vars package number 1_282 Rptdt 201301
Dim db As Database 'generic database object
Dim rst As Recordset 'this is going to hold the query result
Set db = CurrentDb
Dim PKG As Double
Dim rptDT As Double
Dim wireDT As Date
Set rst = db.OpenRecordset("SELECT Max(tbl_Revision.Revision_Number) as Revision_Number FROM tbl_Revision" & _
" where (tbl_Revision.RUN_YR_MO=" & rptDT & ")" & _
" and (tbl_Revision.Package_Number=" & PKG & ")")
getRevision = rst!Revision_Number + 1
Upvotes: 1
Views: 2107
Reputation: 6020
The PKG cant be a Double if you want 1_282 to work. So make it a string. Also you will have to add quotes :
" where (tbl_Revision.RUN_YR_MO='" & rptDT & "')" & _
Upvotes: 3