Pass a variable to a pop-up form

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
 
L

Linq Adams via AccessMonster.com

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.
 
P

PJFry

Got it.

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

me.txtClientNm = Forms!Input!txtClientNm
 
M

Marshall Barton

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
 

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

Similar Threads


Top