Placing Customer Order

  • Thread starter Thread starter Simon
  • Start date Start date
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
 
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
 
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'
 
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
 
Back
Top