Passing variable result to originating form

  • Thread starter Thread starter dbvba
  • Start date Start date
D

dbvba

Guest
I have 2 forms. On the Form1, I have a public variable (stRecalc) declared as a string.

On a BeforeUpdate event of a field, I open another Form2 which is a dialog box and asks a question, which can result in one of 3 answers. The user clicks one of three buttonw to answer the questions. The onclick event fills the variable with a string answer which I want to pass back to the originating form.

I can't seem to get that variable back to the originating form, as soon as Form2 closes, its value is lost.

Any ideas?

Thanks!!
 
What if you declare the variable public in a standard module (Not one associated to a from or report)?
 
Not sure but you could try something like this just before form2 closes

Forms![YourformName]!Fieldname = returnValue

returnvalue = the value from form2 you want to pass back to form 1.

hope it helps
 
Thanks - I got it to work using a hidden text box on my form1. I was just hoping to pass the value rather than using yet another text box! Thanks again for your help!!:)
 

Users who are viewing this thread

Back
Top Bottom