Cancel Update

  • Thread starter Thread starter B F Cole
  • Start date Start date
B

B F Cole

If you are in the forms update event and with VB logic determine that the
update needs to be cancelled, what is the code?

Example below doesn't seem to work.

Private Sub Form_BeforeUpdate(Cancel As Integer)
if me.date1 < me.date2 then
ianswer=msgbox("Date1 can not be before Date2...correct...",vbcritical)
Cancel = True
me.date1.setfocus ' Go back and correct date
end if

End Sub

Thanks for your always good suggestions,
Bill
 
Hi,



Me.Undo for all the fields, or Me.ControlName.Undo, for a single field



Hoping it may help,
Vanderghast, Access MVP
 

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

Similar Threads

Error Message Run Time 2465 2
Validation Error 2
Comparison in date 5
Modify Date procudure 2
DATEMODIFIED FIELD 1
Delete code competing with BeforeUpdate validation 2
AutoSkip 1
Required Entry 2

Back
Top