CancelUpdate usage

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying not to update a field when the user has changed the info and then
selects the Cancel button from a message box. I've seen the .CancelUpdate but
dont know how to use it. Can someone give me some clues? in this instance the
control field is VendorID and the code is called from the BeforeUpdate Event.
I'm really new at VB
THanks, here is my code:
MsgBox "Change " & strControlName & "?", vbOKCancel, "Change Field?"

Select Case vbCancel
Case Is = 2
Select Case strControlName
Case Is = "VendorID"
' what should go here?
End Select
End Select
 
I'm trying not to update a field when the user has changed the info and then
selects the Cancel button from a message box. I've seen the .CancelUpdate but
dont know how to use it. Can someone give me some clues? in this instance the
control field is VendorID and the code is called from the BeforeUpdate Event.
I'm really new at VB
THanks, here is my code:
MsgBox "Change " & strControlName & "?", vbOKCancel, "Change Field?"

Select Case vbCancel
Case Is = 2
Select Case strControlName
Case Is = "VendorID"
' what should go here?
End Select
End Select

It's not CancelUpdate; the BeforeUpdate routine has an argument
Cancel. Just set it to True:

Private Sub VendorID_BeforeUpdate(Cancel as Integer)

.... <your checking code>

Cancel = True
....
End Sub

will cause the Update to be left undone. To blank out the control, so
the user can reenter it, add a line

Me!VendorID.Undo

after the Cancel = True.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top