Required Controls Causing Me A Problem

  • Thread starter Thread starter Kelvin Middleton
  • Start date Start date
K

Kelvin Middleton

Hi,

I've got an Access 2000 form with several controls which are all bound. I'm
trying to make this user friendly but am a little stumped.

If I want to close the form without completing a record and thus loose all
the data I get an error because I have set all the fields to 'Required'. I
have written a little code which sets all the controls to Null prior to exit
but still get the same error. I've also tried deleting the current record
but this doesn't work, it won't delete because there isn't anything there to
delete.

Can anyone offer some assistance? Please either follow up this post for
email me direct. Thanks in advance.

Kelvin

email: (e-mail address removed)
 
You're probably getting an error for trying to set the values to Null on
fields that won't allow Null.

Try Me.Undo
 
Cheers guys, both helped. I ended up using 'sendkeys "{esc}" x2 in my code
to accomplish what I wanted and you were spot on rowiga about the nulls.

Kelv
 
Kelvin Middleton said:
Hi,

I've got an Access 2000 form with several controls which are all
bound. I'm trying to make this user friendly but am a little stumped.

If I want to close the form without completing a record and thus
loose all the data I get an error because I have set all the fields
to 'Required'. I have written a little code which sets all the
controls to Null prior to exit but still get the same error. I've
also tried deleting the current record but this doesn't work, it
won't delete because there isn't anything there to delete.

Can anyone offer some assistance? Please either follow up this post
for email me direct. Thanks in advance.

Kelvin

I strongly counsel you against posting your e-mail address openly in
newsgroups -- you'll get spammed horrendously.

What you need to do is "undo" your form, which you can do by calling the
form's Undo method. From code running behind the form, you would write:

Me.Undo

Note that setting various controls to Null does not make them the same
as never edited. Only "undoing" them, or undoing the form, does that.
 

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

Back
Top