Reputation: 1
I want to open a report namely "Invoice" (based on a query, which is joint with different two tables namely Customer Details and Product Details) by clicking a command button based on three different combobox namely Customer type, Name of the Customer and Cash memo number. I created a code given bellow and get error....Please help.
Code: DoCmd.OpenReport "Invoice", acViewReport, , "[Customer Type] = " & Me.ltyp and [Name of the Customer] = " & Me.lcnm And [Cash Memo/Tax Invoice Number] = " & Me.lmnum, acWindowNormal"
DoCmd.OpenReport "Invoice", acViewReport, , "[Customer Type] = " & Me.ltyp and [Name of the Customer] = " & Me.lcnm And [Cash Memo/Tax Invoice Number] = " & Me.lmnum, acWindowNormal"
Please resolve my issue.
Upvotes: -2
Views: 28
Reputation: 279
Your code is wrong. You have to differentiate between text and numbers. Assuming that [Customer Type] and [Name of the Customer] are text and [Cash Memo/Tax Invoice Number] is a number, it should look like this:
DoCmd.OpenReport "Invoice", acViewReport, , "[Customer Type] = '" & Me.ltyp & "' and [Name of the Customer] = '" & Me.lcnm & "' And [Cash Memo/Tax Invoice Number] = " & Me.lmnum, acWindowNormal
Text must be always put in quotes, numbers not.
Upvotes: 1