pop up 7768 error & dirty

N

NetworkTrade

In Access02 have a main form with a button that opens a popup form....user
can enter into that popup then close...and all this works fine.

Realized that if they do an "oops"...don't really want that popup...and they
just close it...it is entering a record into the table with no data but the
record's key autonumber and a default timestamp value that is needed in one
field...

So I thought adding a me.dirty=true into the OnClose event if the user's
field is null (meaning they put in no data) but it is throwing a 7768 error
saying that "the cursor must be in a field that can be modified"....a bit
cryptic since the cursor is in the first empty field...

How's the right way to close this form without making a record entry?
 
S

Stuart McCall

NetworkTrade said:
In Access02 have a main form with a button that opens a popup form....user
can enter into that popup then close...and all this works fine.

Realized that if they do an "oops"...don't really want that popup...and
they
just close it...it is entering a record into the table with no data but
the
record's key autonumber and a default timestamp value that is needed in
one
field...

So I thought adding a me.dirty=true into the OnClose event if the user's
field is null (meaning they put in no data) but it is throwing a 7768
error
saying that "the cursor must be in a field that can be modified"....a bit
cryptic since the cursor is in the first empty field...

How's the right way to close this form without making a record entry?

Try using Me.Undo instead of Me.Dirty = True
 
N

NetworkTrade

tried your suggestion; no error but still making a blank record entry....

still need a fix...
 
M

mtn244

Try testing for null fields and using the me.undo in the form's before update
event. This should catch it before the record is written to the table.
 

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