Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default msgBox pops up twice ??

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

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default msgBox pops up twice ??

when your code sets the value for checkbox2, its fires the click event.

"Tempy" wrote:

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

*** Sent via Developersdex http://www.developersdex.com ***

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default msgBox pops up twice ??

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

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default msgBox pops up twice ??

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)


"Tempy" wrote in message
...
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

*** Sent via Developersdex http://www.developersdex.com ***



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default msgBox pops up twice ??

Thanks Bob, your a life saver.

best regards,

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel configuration window always pops up Lisa Setting up and Configuration of Excel 0 March 28th 07 02:42 AM
If I click a hyperlink it pops up and goes away Chris Excel Discussion (Misc queries) 1 January 12th 07 03:10 PM
Button Pops up Graph pete3589 Excel Discussion (Misc queries) 3 November 5th 05 07:03 PM
remove text that pops up with combo box Jeff Excel Worksheet Functions 1 September 21st 05 02:36 AM
How do I display a dialog box that pops up when you first open exc Erin Excel Discussion (Misc queries) 4 June 22nd 05 07:27 PM


All times are GMT +1. The time now is 04:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"