M
Manuel
HI:
I have a form with a check box and a text box on it. To close the form the
user clicks the "X" located at the top right of the form.
What I'd like to do is have code that executes on the On Close event which
does not close the form if the user has checked the check box but has not put
anything in the text box.
I know I could accomplish this with a command button by having the command
button only close the form if certain conditions are met, but I don’t want to
add a command button to the form, I want the only option for closing the form
to be the “Xâ€.
Does anyone have any suggestions for how I would go amount accomplishing this.
Here’s what I have so far. The Cancel = True code does not work here; I
don’t think it’s appropriate:
Private Sub Form_Close(Cancel)
If Me.ckbxBetween = True And Me.txtInvIn.Value = "" Then
MsgBox "No Investor ID's Selected. Select Investot ID's or uncheck
""""Between"""" checkbox.", vbCritical, MsgBxTitle
Cancel = True
Exit Sub
End If
I have a form with a check box and a text box on it. To close the form the
user clicks the "X" located at the top right of the form.
What I'd like to do is have code that executes on the On Close event which
does not close the form if the user has checked the check box but has not put
anything in the text box.
I know I could accomplish this with a command button by having the command
button only close the form if certain conditions are met, but I don’t want to
add a command button to the form, I want the only option for closing the form
to be the “Xâ€.
Does anyone have any suggestions for how I would go amount accomplishing this.
Here’s what I have so far. The Cancel = True code does not work here; I
don’t think it’s appropriate:
Private Sub Form_Close(Cancel)
If Me.ckbxBetween = True And Me.txtInvIn.Value = "" Then
MsgBox "No Investor ID's Selected. Select Investot ID's or uncheck
""""Between"""" checkbox.", vbCritical, MsgBxTitle
Cancel = True
Exit Sub
End If