Prevent update of a blank record using vba

M

Macy

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.
 
E

EddieA

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top