Transfer Textbox value and run code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do you transfer a Textbox value from Form1 to Form2 and then have code
run on that value that you have transferred?
 
It will depend on whether Form2 is open at the time you want the transfer to
take place. If both Form1 and Form2 are open, you could put this line in the
Lost Focus Event of the text box on Form1:
[forms]![Form2]![MyTextBox2] = Me.MyTextbox1

If Form1 opens Form2, then you will want to use the OpenArgs property.
Access Help has an example of how to use the OpenArgs property.
 
I can get the values to transfer. Form1 meets certain crtieria and then
Form2 opens and viceversa, but in order to get the code to run I have to
backspace over the last digit and re-enter it. OR if OepnArgs is the answer,
I cannot get that to work....just gives me a null value.

Klatuu said:
It will depend on whether Form2 is open at the time you want the transfer to
take place. If both Form1 and Form2 are open, you could put this line in the
Lost Focus Event of the text box on Form1:
[forms]![Form2]![MyTextBox2] = Me.MyTextbox1

If Form1 opens Form2, then you will want to use the OpenArgs property.
Access Help has an example of how to use the OpenArgs property.

Jenny at APOC said:
How do you transfer a Textbox value from Form1 to Form2 and then have code
run on that value that you have transferred?
 
sooooooooooo you didn't tell me everything, huh? :)
Based on what you posted last, it appears that the text box you want the
value to pass from is not the last control to have the focus before it opens
Form2.
In that case, you need to use the Openargs property. It wont happen on it's
own, you will have to put some code in Form2 Open event to use the passed
value. Look in Access Help for OpenArgs property and the OpenForm Method.
The OpenArgs property example should explain it all.

Jenny at APOC said:
I can get the values to transfer. Form1 meets certain crtieria and then
Form2 opens and viceversa, but in order to get the code to run I have to
backspace over the last digit and re-enter it. OR if OepnArgs is the answer,
I cannot get that to work....just gives me a null value.

Klatuu said:
It will depend on whether Form2 is open at the time you want the transfer to
take place. If both Form1 and Form2 are open, you could put this line in the
Lost Focus Event of the text box on Form1:
[forms]![Form2]![MyTextBox2] = Me.MyTextbox1

If Form1 opens Form2, then you will want to use the OpenArgs property.
Access Help has an example of how to use the OpenArgs property.

Jenny at APOC said:
How do you transfer a Textbox value from Form1 to Form2 and then have code
run on that value that you have transferred?
 
Back
Top