msgBox pops up twice ??

T

Tempy

Hi all, i am a little stumped with the following:- I have an input form
that i have various textboxes and check boxes. The one box must be
clicked before the other so i put in a long if statement and if none are
checked then a message. the problem is if i click on the check box
before the first one, is that it flags it and i need to clear it again
so did that after the message, it clears it but then brings the message
up again and i do not want to have this ??

Private Sub CheckBox2_Click()
If OptionButton2 = True Then
TextBox3.Visible = True
TextBox17.Visible = True
CheckBox1.Enabled = False
ElseIf OptionButton8 = True Then
TextBox3.Visible = True
TextBox17.Visible = True
CheckBox1.Value = False
Else
MsgBox "Please first select from which year to begin " & vbCrLf
& _
" your tooling payments in order to continue", 48,
"ZA-T-M-22"
CheckBox2.Value = False
End If

End Sub

I have tried both befor and after the message

Tempy
 
T

Tempy

Hi Patrick, sorry i am a newbie at this game, that is why i put the if
statment within the click event ? If i remove the "CheckBox2.Value =
False" statement, the message does not come up twice ?
Could you suggest how i could fix it ?

Tempy
 
B

Bob Phillips

Private Sub CheckBox2_Click()
Static mReEntry

If Not mReEntry Then
mReEntry=True
If OptionButton2 = True Then
TextBox3.Visible = True
TextBox17.Visible = True
CheckBox1.Enabled = False
ElseIf OptionButton8 = True Then
TextBox3.Visible = True
TextBox17.Visible = True
CheckBox1.Value = False
Else
MsgBox "Please first select from which year to begin " & _
vbCrLf & " your tooling payments in order to
continue", _
48, "ZA-T-M-22"
CheckBox2.Value = False
End If
mReEntry = False
End If

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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