Hi Guys
I'm trying (unsuccessfully) to create and End If statement within another End If statement. Here's what I've got so far.
Private Sub CmdClose_Click()
If IsNull(Me.TxtCompletion) Or IsNull(Me.TxtCopy) Then
MsgBox "Please complete ALL of the details", vbExclamation
Else
DoCmd.Close
End If
Basically the close cmd button checks to see if various fields have entries, if they do the form will close, if not an error message will be displayed.
What I'd like to do is create something like this:
Private Sub CmdClose_Click()
If IsNull(Me.TxtCompletion) Or IsNull(Me.TxtCopy) Then
MsgBox "Please complete ALL of the details. Do you want to quit without saving?", vbYesNo
If vbYes then
Me.TxtCompletion =Null
Me.TxtCopy = Null
DoCmd.Close
End if
End If
At the moment the form closes regardless of whether the user presses Yes or No.
Any ideas?
Dave
I'm trying (unsuccessfully) to create and End If statement within another End If statement. Here's what I've got so far.
Private Sub CmdClose_Click()
If IsNull(Me.TxtCompletion) Or IsNull(Me.TxtCopy) Then
MsgBox "Please complete ALL of the details", vbExclamation
Else
DoCmd.Close
End If
Basically the close cmd button checks to see if various fields have entries, if they do the form will close, if not an error message will be displayed.
What I'd like to do is create something like this:
Private Sub CmdClose_Click()
If IsNull(Me.TxtCompletion) Or IsNull(Me.TxtCopy) Then
MsgBox "Please complete ALL of the details. Do you want to quit without saving?", vbYesNo
If vbYes then
Me.TxtCompletion =Null
Me.TxtCopy = Null
DoCmd.Close
End if
End If
At the moment the form closes regardless of whether the user presses Yes or No.
Any ideas?
Dave