-
Help with VBA
This is the code:
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "ReportName", acNormal, , "([OrderID])=" & Me.[OrderID]
I put this on the print button in my form. What I want to happen is for a report to generate as a result of pressing the button. I do not necessarily want it to print, but that is what someone else told me to do. So on the print button, in the property sheet on the OnClick is the code above. Is that where I am supposed to put the code? Also, what do I need to change about it? When I pressed the button in Form View, an error message came up. I have attached the screenshot.
What do I need to change in the code to get this to work? The overall result I would like is that the user fills out the order form, and at the bottom of the form is a button that says 'Generate Receipt', and a new report creates itself with all of the data given on the order form. There are buttons on this receipt to save, print, email and return to the other form.
Is this the right code for the job?
-
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules