I am trying to create a DLookup with multiple criteria in Access 2010, and running into a little trouble. I create invoices via a form. On the invoice form I select the AccountID, and set billing month and year. Based on that information, I would like to search my Prepayment query (quePrepayment) and pull in any prepayments that match those three criteria.
I am currently getting this error:
Run-time error '3075':
Syntax error (missing operator) in query expression 'AccountID= & Query![quePrepayment]!AccountID & Billing_Month = & Query![quePrepayment]!Billing_Month & Billing_Year = & Query![quePrepayment]!Billing_Year)'
I am currently getting this error:
Run-time error '3075':
Syntax error (missing operator) in query expression 'AccountID= & Query![quePrepayment]!AccountID & Billing_Month = & Query![quePrepayment]!Billing_Month & Billing_Year = & Query![quePrepayment]!Billing_Year)'
Code:
Private Sub AccountID_Change()
Billling_Prepayment = DLookup("Total_Prepayment", "quePrepayment", "AccountID = & Query![quePrepayment]!AccountID & Prepayment_Month = & Query![quePrepayment]!Prepayment_Month & Prepayment_Year = & Query![quePrepayment]!Prepayment_Year")
End Sub