whatdoidonext
New member
- Local time
- Today, 23:13
- Joined
- Jul 5, 2005
- Messages
- 8
Hi
I did post this last week but think I confused everyone!
Form 1 has defined a public variable gflag as in integer. The code starts with the on click event of a button on form1
The initial value of gflag is then set to 1.
Various tests are performed then on line 25 a second form is opened with
DoCmd.OpenForm"form2",acNormal,,,,acDialog
Information is then passed from form1 to form2 to populate it.
As form 2 is opened modally the user has to select one of 2 buttons on the form to exit.
For button1
button1_Click()
gflag =2
DoCmd.Close
End Sub
For button2
button_Click()
gflag=1
DoCmd.Close
End Sub
What I was hoping to happen was that as soon as the user clicked a button operation would be return to line 26 in form1 to test the value of gflag e.g.
if gflag=2 Then
do x
End if
Unfortunately, after putting in a test to show the value of gflag in form 1 it appears the code opens form 2 ok but then immediately processes line 26 as if gflag is always =1, before the user has actually pressed a button on form2.
This is driving me potty, please explain what I am doing wrong and help me find a solution.
Thanks in anticipation.
I did post this last week but think I confused everyone!
Form 1 has defined a public variable gflag as in integer. The code starts with the on click event of a button on form1
The initial value of gflag is then set to 1.
Various tests are performed then on line 25 a second form is opened with
DoCmd.OpenForm"form2",acNormal,,,,acDialog
Information is then passed from form1 to form2 to populate it.
As form 2 is opened modally the user has to select one of 2 buttons on the form to exit.
For button1
button1_Click()
gflag =2
DoCmd.Close
End Sub
For button2
button_Click()
gflag=1
DoCmd.Close
End Sub
What I was hoping to happen was that as soon as the user clicked a button operation would be return to line 26 in form1 to test the value of gflag e.g.
if gflag=2 Then
do x
End if
Unfortunately, after putting in a test to show the value of gflag in form 1 it appears the code opens form 2 ok but then immediately processes line 26 as if gflag is always =1, before the user has actually pressed a button on form2.
This is driving me potty, please explain what I am doing wrong and help me find a solution.
Thanks in anticipation.