I am creating a simple invoice system in access. I currently have a form that I can use to view a particular invoice for a particular customer_id. I would also like to use this same form to add a new invoice. When the form is opened, I’d like it to already know that I want to use customer id #x. I already have the invoice table joined to the customer table on the “customer_id” field.
Currently when I open the form, it opens a blank invoice form that isn’t tied to a customer at all. Basically what I want to know is, how to pass the customer ID to the form so it knows I’m “adding” a new record tied to an already-created customer ID.
(Normally I’m just opening the form, and it is already populated with the invoice details, and the customer info which is joined to the invoice details, I’d just like to be able to add a new record which is already tied to the customer)
You can pass an argument to a form when you open it by using the optional parameter
OpenArgsof theDoCmd.OpenFormmethod.In the form, you can get the value via
Me.OpenArgs.EDIT:
No, you just pass the value to OpenArgs, nothing else:
Unfortunately you can only pass one argument via OpenArgs.
If you need more, you have to do some tricks.