Hi,
I have a form that has a textbox which display score of 0, I have a button, when clicked another form is open (the current form is hidden not closed). The second form has a button, when clicked it is assigning a global variable a value (say 100) then closes the 2nd form and make the first one visible again. Now, the textbox (at the start) had value of 0 and it is takijg the value of the global variable which should show 100 but it is not showing that. if i close the form and open again it is showing the 100. How to do it without closing and opeining the form?
form1 (on load)
Code:
Me.ahmad.Text = Module1.AhmadScore 'global variable
form1 (button click)
Code:
Private Sub ahmad100_Click()
Me.ahmad200.Visible = True
Me.ahmad200.SetFocus
Me.ahmad100.Visible = False
DoCmd.OpenForm "form1"
Me.Visible = False
End Sub
form2
Code:
Private Sub Command5_Click()
If (Module1.AhmadScore = 0) Then
DoCmd.OpenQuery "updateAhmad"
Module1.AhmadScore = 100
DoCmd.Close acForm, "form1"
Forms![main].Visible = True
ElseIf (Module1.AhmadScore = 100) Then
DoCmd.OpenQuery "updateAhmad"
Module1.AhmadScore = 300
DoCmd.Close acForm, "form1"
Forms![main].Visible = True
End If
End Sub