R
Rob Parker
I have the following code in a Close button on a form:
Private Sub cmdClose_Click()
'delete new record with no description
If Me.OpenArgs = "New" And IsNull(txtDescription) Then
Me.Undo
End If
DoCmd.Close acForm, "frmArising"
End Sub
I'm using this since the form is dirtied by code which enters default
values for several fields; what I want to do is delete the record if no
description has been entered. My problem is that sometimes this works,
and sometimes (mostly) it doesn't (ie. the record is saved when both
tests in the If statement are true).
It seems that the record is never saved if I run the code by stepping
through it, but if I just let it run unhindered then the outcome is
inconsistent - sometime the record is saved, sometimes not.
The application (Access 2003) is split, with a local front-end with
links to a back-end .mdb file on a network server. The form's
recordsource is a query based on a linked table.
Any suggestions/comments gratefully received,
Rob
Private Sub cmdClose_Click()
'delete new record with no description
If Me.OpenArgs = "New" And IsNull(txtDescription) Then
Me.Undo
End If
DoCmd.Close acForm, "frmArising"
End Sub
I'm using this since the form is dirtied by code which enters default
values for several fields; what I want to do is delete the record if no
description has been entered. My problem is that sometimes this works,
and sometimes (mostly) it doesn't (ie. the record is saved when both
tests in the If statement are true).
It seems that the record is never saved if I run the code by stepping
through it, but if I just let it run unhindered then the outcome is
inconsistent - sometime the record is saved, sometimes not.
The application (Access 2003) is split, with a local front-end with
links to a back-end .mdb file on a network server. The form's
recordsource is a query based on a linked table.
Any suggestions/comments gratefully received,
Rob