VBA Varriable in Select statement

marrett

Registered User.
Local time
Today, 05:06
Joined
Sep 8, 2000
Messages
43
Hi
I Have the following statement and I cannot get it to work.

Set Rec = DB.OpenRecordset("Select * From [Loan_Tbl]where Loan ID = Loan")


Can I use a varriable to selct form a table.

Thnaks,

Maria
 
If Loan is the variable then try: -

Set Rec = DB.OpenRecordset("Select * From [Loan_Tbl] where LoanID = " & Loan)
 
Thanks! I have another question if you would nnot mind

Can I use more than one variable?
Set Rec = DB.OpenRecordset("Select * From [Loan_Tbl] where [Loan ID] = " & Loan) and where [loan date ] =dateofloan

Thanks,

Maria

PS do you know of any book I can buy where I could look up this stuff myself. I learned access by myself and I am very good at a lot of it, but I could be much better with the right book.

Thanks
 
Don't know of book but code ought to be

Set Rec = DB.OpenRecordset("Select * From [Loan_Tbl] where [Loan ID] = " & Loan & " and where [loan date ] = " & dateofloan)
 

Users who are viewing this thread

Back
Top Bottom