Toggle Trouble in MultiPage UserForm

DMKean

New member
Joined
Jan 4, 2013
Messages
1
Reaction score
0
Points
0
Location
BC's Northern Capital
I'm a newbie when it comes to VBA and most of the problems I've had I've been able to figure out with the help of my John Walkenbach book and the internet but this problem eludes me.

I'm building a Wizard and am using a toggle button to indicate whether or not a procedure has been done. Click the toggle if it's been done (value True), don't click the toggle if it hasn't (value False). Once the user clicks my "Finish" button and transfers the entered data to a spreadsheet, including the toggle selection, the text boxes and the toggle should clear/reset. My text boxes clear, but my toggle doesn't reset. What am I missing?

My toggle has the following code attached:
Private Sub toggleYes1_Click()
Me.toggleYes1 = True
End Sub

Following is some of the code attached to my Finish button (this is to clear my text boxes and reset the toggle).
me.tbDrugName2 = ""
me.toggleYes1 = FALSE
me.tbAdditionalNotes2 = ""
me.tbSize2 = ""
me.tbAdjustmentQuantity = ""
me.tbUnitCost = ""

Any help anyone could provide would be very helpful! :)
 
the line:
me.toggleYes1 = FALSE
is itself triggering the toggleYes1_Click event.

You could use a global variable thus:
Code:
Dim [B][COLOR=#0000ff]ToggleClickSuppress[/COLOR] [/B]As Boolean 'the global variable

Private Sub CommandButton1_Click()
Me.tbDrugName2 = ""
[COLOR=#0000ff][B]ToggleClickSuppress = True[/B][/COLOR]
Me.toggleYes1 = False
[COLOR=#0000ff][B]ToggleClickSuppress = False[/B][/COLOR]
Me.tbAdditionalNotes2 = ""
Me.tbSize2 = ""
Me.tbAdjustmentQuantity = ""
Me.tbUnitCost = ""
End Sub

Private Sub toggleYes1_Click()
If Not [B][COLOR=#0000ff]ToggleClickSuppress [/COLOR][/B]Then Me.toggleYes1 = True
End Sub

 
Last edited:
Back
Top