Mikeymike_W
Board Regular
- Joined
- Feb 25, 2016
- Messages
- 171
Hi there,
I'm rying to set a condition on a user form so that the user needs to close a textbox before the open another. The textbox is opened via a command button.
I have never used the "OR" function before so had a look online. The code I have just opens up the msgbox regardless f whether or not other textboxes are open and i'm not sure where to go from here.
In the code below i'm trying to say that if TBPsychology1 is visible then just make it invisible, however if it is invisible check to see if other textboxes are visible, if they are then prompt the user to close them alternatively if no other textbox is visible then just make TBPsychology1 visible.
I hope that makes sense.
Thanks in advance for your help!
I'm rying to set a condition on a user form so that the user needs to close a textbox before the open another. The textbox is opened via a command button.
I have never used the "OR" function before so had a look online. The code I have just opens up the msgbox regardless f whether or not other textboxes are open and i'm not sure where to go from here.
In the code below i'm trying to say that if TBPsychology1 is visible then just make it invisible, however if it is invisible check to see if other textboxes are visible, if they are then prompt the user to close them alternatively if no other textbox is visible then just make TBPsychology1 visible.
I hope that makes sense.
Thanks in advance for your help!
VBA Code:
Private Sub CBPsychology_Click()
If TBPsychology1.Visible = False Then
If TBPsychology2.Visible = True Or TBPsychology3.Visible = True Or TBPsychology.Visible = True Then
MsgBox "Please close any open dialogue boxes", , "Close Dialogue Boxes"
Exit Sub
Else
TBPsychology1.Visible = True
End If
End If
If TBPsychology1.Visible = True Then
TBPsychology1.Visible = False
End If
End Sub