Check box Before Update

S

Samantha

I am in the process of migrating the backend to MySQL and testing the
frontend with MsAccess 2000. I need to check that all necessary data fields
are entered before I make the update on a subform by using the BeforeUpdate
event on a checkbox (Checkbox1). But the BeforeUpdate event still updates the
data even if I use undo and exit sub on the code.
This is what I have so far:

If Me![Checkbox1].Value <= -1 Then
If isnull(text1) then
Me![Checkbox1].Undo
Exit Sub
End If
End If
Any help is very much appreciated. thank you.
 
G

George Nicholson

BeforeUpdate event has a Cancel argument for this purpose. Add the line
Cancel = True
to the appropriate place in your code and the Update won't happen.

HTH,
 
S

Samantha

Works like a charm. Thanks Geroge.

George Nicholson said:
BeforeUpdate event has a Cancel argument for this purpose. Add the line
Cancel = True
to the appropriate place in your code and the Update won't happen.

HTH,
--
George Nicholson

Remove 'Junk' from return address.


Samantha said:
I am in the process of migrating the backend to MySQL and testing the
frontend with MsAccess 2000. I need to check that all necessary data
fields
are entered before I make the update on a subform by using the
BeforeUpdate
event on a checkbox (Checkbox1). But the BeforeUpdate event still updates
the
data even if I use undo and exit sub on the code.
This is what I have so far:

If Me![Checkbox1].Value <= -1 Then
If isnull(text1) then
Me![Checkbox1].Undo
Exit Sub
End If
End If
Any help is very much appreciated. thank you.
 

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