If statement

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

I have an If statement that checks if the user has entered a new record.
Here is my code

If Me.NewRecord Then
If vbYes = MsgBox("Do you want to save any changes you have made to this
record?", 36, "Enter New Record") Then
DoCmd.Requery "Docnumtxt"
DoCmd.RunCommand acCmdSaveRecord
Else
Me.Undo
Cancel = True
End If
End If
End If
DoCmd.Close
End If

How do I use the Else statement to check if it isn't a new record?
Thanks IA
Tony Williams
 
Hi Tony

see below:

If Me.NewRecord Then
If vbYes = MsgBox("Do you want to save any changes you have made to this
record?", 36, "Enter New Record") Then
DoCmd.Requery "Docnumtxt"
DoCmd.RunCommand acCmdSaveRecord
Else
Me.Undo
Cancel = True
End If
ELSE
'WHATEVER YOU WANT TO DO IF Me.NewReocord = False
End If
End If - not sure what this end if relates to
DoCmd.Close
End If - not sure what this end if relates to

Hope this helps

Cheers
JulieD
 
Works just great Julie!!!!
Thanks again
Tony
JulieD said:
Hi Tony

see below:

If Me.NewRecord Then
If vbYes = MsgBox("Do you want to save any changes you have made to this
record?", 36, "Enter New Record") Then
DoCmd.Requery "Docnumtxt"
DoCmd.RunCommand acCmdSaveRecord
Else
Me.Undo
Cancel = True
End If
ELSE
'WHATEVER YOU WANT TO DO IF Me.NewReocord = False
End If


Hope this helps

Cheers
JulieD
 
Back
Top