Placing Customer Order

S

Simon

When i place a customer order,i first go to frmCustomer where i enter
the customers details. I then have a button that opens up frmOrder to
place the order.

The problem is that i have to type in the customer ID number in on the
form.

Is there any way when i click place order on frmCustomer it will
automaticl put customer ID number on the Order form.



Thanks

Simon
 
G

Guest

When you open the second form, pass the id number in the OpenArgs parameter
of the OpenForm method. Something like this:
DoCmd.OpenForm "frmOrder", OpenArgs:=Me.CustomerId

Then in the OnLoad event of frmOrder, set the Id based on it's open args:
Me.txtCustId = Me.OpenArgs

Barry
 
S

Simon

Thanks for your help
I do not understand the first part of the code and where i have to
write it
'When you open the second form, pass the id number in the OpenArgs
parameter
of the OpenForm method. Something like this:
DoCmd.OpenForm "frmOrder", OpenArgs:=Me.CustomerId'
 
G

Guest

You have a button on the first form that you click to open the second form.
You need to put the code under the button's OnClick event. Clear whatever;s
in that spot and click the elipsis (...) to the right. Select Code Builder.
This will bring you to the code editor. Paste the code into that event,
changing the form name to the name of your form and the value for the Id
(instead of CustomerId).

The second part of the code goes in the 2nd form's OnLoad event.

Barry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top