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 ToggleClickSuppress As Boolean 'the global variable Private Sub CommandButton1_Click() Me.tbDrugName2 = "" ToggleClickSuppress = True Me.toggleYes1 = False ToggleClickSuppress = False Me.tbAdditionalNotes2 = "" Me.tbSize2 = "" Me.tbAdjustmentQuantity = "" Me.tbUnitCost = "" End Sub Private Sub toggleYes1_Click() If Not ToggleClickSuppress Then Me.toggleYes1 = True End Sub
Last edited by p45cal; 2013-11-28 at 02:21 PM.
Bookmarks