1

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
2
  • 1
    what type tbl_Revision.Package_Number is ? Commented Sep 27, 2013 at 11:28
  • 1
    The package_number is a text field in the table. Commented Sep 27, 2013 at 12:59

1 Answer 1

3

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 & "')" & _
Sign up to request clarification or add additional context in comments.

1 Comment

" and (tbl_Revision.Package_Number=" & PKG & ")")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.