My pop-up form doesn't show customer number

JimJones

Registered User.
Local time
Today, 11:46
Joined
May 6, 2003
Messages
78
Hi,

I have a command button, which pops up a form. The form has two fields. One is the customer number, and the other is "Notes".

The user is to be able to enter notes on this particular customer, in a field specified as the "memo" type.

I created the button with the wizard, and thought it would match the customer number of the main form, since the tables from both of these forms are linked.

But, when the notes form pops up, the customer number is 0.
not the presently displayed customer number.

Please help,
Thanks,
Jim
 
You'll need to either:

  1. pass the ID as an OpenArg;
  2. reference the ID from the new form on the Load event
    [/list=1]
 
Hi,

Can you direct me to an example of this ?
Thanks,
Jim
 
1. - Pass as an OpenArg:

when opening a form, one of the parameters you can use is the OpenArgs. This is passed to the new form's OpenArgs. In the code below a form called SecondForm is being opened and the value in the textbox (txtMyID) on the calling form is passed to the second form.

Code:
DoCmd.OpenForm "SecondForm", , , , ,acDialog, Me.txtMyID

Now, in the second form, we can make use of this value whenever we want by referring to the OpenArgs property:

Code:
Private Sub Form_Load
    txtCustomerCode = Me.OpenArgs
End Sub

That would put the value into a textbox on the form as it loads.


2. - Reference

Basically:

Code:
Private Sub Form_Load
    txtCustomerCode = Forms("FirstForm").txtMyID
End Sub
 
Perfect !

Though a simple fix, I wouldn't know where to begin to find
the solution, if it wasn't for this forum.

Thanks,
Jim
 

Users who are viewing this thread

Back
Top Bottom