I watched the video on how to retrieve a single report for a customer using a VBA code. On some buttons and forms, it works great. However, it does not work on all buttons and all forms I'm getting a runtime error, see attached. Could you help me with this dilemma?
James McMillan
Scott Axton
James this is a bit to broad of a post. Can you post, possibly with screenshots, what exactly you are having issues with?
Scott Axton
Sorry we posted at the same time.
Just looking at the formula is your "CustomerId=" & Customer accurate? I'm guessing your field may be actually CustomerID
So "CustomerId=" & CustomerID
It's a bit hard to read it appears that the screen capture is cut off a bit. Do you have spaces in your report name?
If so put them in brackets. [ ]
In fact even if it doesn't put it in brackets. Going back to Beginner 1, Access field names, reports, forms, etc. should only contain letters and on occasion a number. Dashes ( - ) especially can be mistaken for subtraction.
I don't know how far along you are in your project but you will save yourself tons of headaches renaming you objects now.
James McMillan
The problem I have is with the DoCmd. See below. It always returns an error where it is highlighted in yellow.
Do you have a valid InstructorID on your form (that is, not null)?
James McMillan
OK, the query was NUll. The record was blank. I'll create a record in that query and try again.
James McMillan
I created a record with an Instructor ID. I checked the table and the query, and the record showed in the table and the query. I ran the VBA code once again and received the same error message.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
TechHelp.
The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.