I was just wondering what the difference between using a report based on a query, where one field in the query has a parameter as a criteria, and the where condition in docmd.openreport is?
For example, I wanted to create a receipt type report that would would open based on a transaction number. So I created a query that prompts for transaction number and then based a report on that query.
Now I am trying to get a button to perform some code (which I have already tested and is working) and open the report based on the transactions number. I would have thought I would need VBA to fill in the transaction number, but I can't get that syntax correct, and adding a where condition doesn't seem to work either.
Here is a sample of my syntax:
MsgBox "Would you like to print a receipt?", vbYesNo,
If vbYes Then DoCmd.OpenReport "Check_Out_Receipt_rpt", acViewPreview, , NextTransactionNum
ElseIf vbNo Then
MsgBox "Receipt will not be printed"
End If
Where NextTransactionNum is a number that is populated via prior code my taking the max of the numbers in a particular field in a table and adding 1.
Thanks in advance for any help provided!