View Full Version : retrieving data in text fields based on passing value from a command button


hyousef
01-24-2002, 02:05 PM
I wan to retrieve data in text fileds(in form2) based on passing value from a command button in form1 to form2.
I have a form1 that contains several text boxes, one of the text boxes is a "project Number", for example, the project number for the first record is "P14X" and the project number for the second record is "P14XZ" and so on..
Lets say i am viewing "record 2" and the project number is "P14XZ"...what i want is when i click "open" button to open another form, pass this project number "P14XZ" that i am currently viewing to a second form, and in the second form i should get this project number plus data in text fields that associated with that project number.
How can i do that?
Thanks in advance.

GTrice
01-24-2002, 03:28 PM
You need to use the Set Filter option. The easiest way to do it is to create a macro with the Open Form command. In the filter box enter "[Project Number] = [Forms]![Form1]![Project Number]. Of course, this is a little kludgey since you end up with a macro. To see a better way - convert the macro into VB then paste the DoCmd script into your Command Button on click/double click property on Form 1. Hope this helps.

Pat Hartman
01-24-2002, 06:13 PM
The OpenForm Method provides arguments that can be used to filter the form being opened. Look it up in help. The "where" argument is the easiest to use.