Pass value from Form2 to Form1

G

Guest

Form1 is bound to Query1. Form1 has a combo box called INST_ID whose Row
Source statement looks like:

SELECT Instruments.ID, Instruments.PartNum
FROM Instruments
ORDER BY Instruments.PartNum;

"Instruments" is the table name.

Button1 next to combo box INST_ID opens up Form2. I created Button1 with the
command button wizard and chose the "Open Form" Action.

Form2 is bound to Query2. Form2 is for users to navigate to the right
Instrument, select it with Button2, and have it update in Form1. What code do
I need in the On Click event of my Button2 in Form2 to pass ID from Form2 to
INST_ID to Form1?

I've tried the following in Button2's On Click event, but I get a Runtime
error "2448":

Me.ID.Value = Forms!Form1!INST_ID.Value

I've also tried changing INST_ID on Form1 from a Combo Box to a Text Box
with the same result.

Any help is appreciated.
 
M

Marshall Barton

Angeldb said:
Form1 is bound to Query1. Form1 has a combo box called INST_ID whose Row
Source statement looks like:

SELECT Instruments.ID, Instruments.PartNum
FROM Instruments
ORDER BY Instruments.PartNum;

"Instruments" is the table name.

Button1 next to combo box INST_ID opens up Form2. I created Button1 with the
command button wizard and chose the "Open Form" Action.

Form2 is bound to Query2. Form2 is for users to navigate to the right
Instrument, select it with Button2, and have it update in Form1. What code do
I need in the On Click event of my Button2 in Form2 to pass ID from Form2 to
INST_ID to Form1?

I've tried the following in Button2's On Click event, but I get a Runtime
error "2448":

Me.ID.Value = Forms!Form1!INST_ID.Value


If button2 os on form2, then that should be the otherway
around:

Forms!Form1!INST_ID.Value = Me.ID.Value
 

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

Top