Pass a variable to a pop-up form

  • Thread starter Thread starter PJFry
  • Start date Start date
P

PJFry

I am working on a form that has two values that I would like to pass to
another form. The user clicks on a command button to trigger the pop-up
form. I want to pass the data in fields txtClientNm and lngOrder to
txtClientNm and lngOrder on the pop-up. In otherwords:
The user is working on client Bob's Surf Shop, order number 123456. He
clicks on the button that triggers the pop-up and that form opens with Bob's
Surf Shop, order number 123456 already populated.

Thanks!
PJ
 
There's a couple ways of doing this, Global variables that some dislike, as
thery can dump their values if an error occurs. You could pass it as an
OpenArgs, with a delimiter, like

Bob's Surf Shop;123456

then use the semi-colon delimiter and Instr() to parse the two parts out.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
Got it.

On the OnLoad event on the form, I used this:

me.txtClientNm = Forms!Input!txtClientNm
 
PJFry said:
I am working on a form that has two values that I would like to pass to
another form. The user clicks on a command button to trigger the pop-up
form. I want to pass the data in fields txtClientNm and lngOrder to
txtClientNm and lngOrder on the pop-up. In otherwords:
The user is working on client Bob's Surf Shop, order number 123456. He
clicks on the button that triggers the pop-up and that form opens with Bob's
Surf Shop, order number 123456 already populated.


Use the OpenForm method's WhereCondition argument to filter
the form's records. For numeric fields use something like::

DoCmd.OpenForm "popupname", _
WhereCondition:= "ClientNm=" & txtClientNm _
& " And Order=" & lngOrder _
WindowMode:= acDialog

For Text fields, use:

DoCmd.OpenForm "popupname", _
WhereCondition:= "ClientNm=""" & txtClientNm _
& """ And Order=""" & lngOrder & """" _
WindowMode:= acDialog
 
Back
Top