Prevent update of a blank record using vba

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form which I am setting to acNewRec when I enter a form (so that the user will have a blank form).
I have a popup dialog box from which the user can select a specific record and display/edit in the form I entered as acNewRec. I do some vba routines displaying messages and validating entries. My problem is if the user does not select a record and I cancel out how do I prevent update of a blank record. I don't have a problem unless the user clicks in a list box field on the form. Even if Imake the likst box = "" access sees it as a new record and updates.
 
Macy said:
I have a form which I am setting to acNewRec when I enter a form (so that the user will have a blank form).
I have a popup dialog box from which the user can select a specific
record and display/edit in the form I entered as acNewRec. I do some
vba routines displaying messages and validating entries. My problem
is if the user does not select a record and I cancel out how do I
prevent update of a blank record. I don't have a problem unless the
user clicks in a list box field on the form. Even if Imake the likst
box = "" access sees it as a new record and updates.

Make sure that none of the bound Controls on the form or fields of the
recordset connected to the table have data before canceling. These
values might be being updated in VBA code before the cancel. You might
need to wipe the data or do a double cancel, i.e. trap for Esc and
issue a second one. Don't know if this will work.

Hope this helps
ee
 
Back
Top