CadMonkey
Misplaced But Useful
- Local time
- Today, 15:38
- Joined
- May 19, 2004
- Messages
- 47
People of this most excellent form,
I have been racking my brains and seraching high and low to try and figure this one....
All I'm trying to do is cancel the creation of a new record on a form when it is detected that a text box has a null value. The bit I'm stuck on is getting the record to dissapear. I've tried the:
me.undo - It doesn't work!
Pressing the escape key twice has the desired affect. Does anyone knopw the VBA code equivalent of this action?? You're a star if you do!
Here's my code:
Private Sub Form_BeforeInsert(Cancel As Integer)
If IsNull(Forms![frmSchedule]![Schedule_ID]) = True Then
MsgBox "Have recognised that schedule is empty"
'need code here to cancel new record
Exit Sub
Else
End If
...
Many thanks,
Simon
I have been racking my brains and seraching high and low to try and figure this one....
All I'm trying to do is cancel the creation of a new record on a form when it is detected that a text box has a null value. The bit I'm stuck on is getting the record to dissapear. I've tried the:
me.undo - It doesn't work!
Pressing the escape key twice has the desired affect. Does anyone knopw the VBA code equivalent of this action?? You're a star if you do!
Here's my code:

Private Sub Form_BeforeInsert(Cancel As Integer)
If IsNull(Forms![frmSchedule]![Schedule_ID]) = True Then
MsgBox "Have recognised that schedule is empty"
'need code here to cancel new record
Exit Sub
Else
End If
...
Many thanks,
Simon