Before Update Event Property Code

  • Thread starter Thread starter Confused
  • Start date Start date
C

Confused

For existing records-When a user changes a name on a combo box, how do I get
the DB to ask the question, "Are you sure you want to change this record"
And if they hit cancel, change the field back to it's original property?
 
Dim intResponse As Integer
intResponse = MsgBox("Are you really sure you want to alter this
record?," & vbCrLf & vbCrLf & "This will update the record." & vbCrLf &
vbCrLf & "Click NO to Cancel" & vbCrLf & vbCrLf & "Click YES to continue",
vbYesNo, "Change record ?")
 
I think you need a little more than that, Wayne.

Private Sub NameOfComboBox_BeforeUpdate(Cancel As Integer)

If MsgBox("Are you really sure you want to alter this record?" & _
vbCrLf & vbCrLf & "This will update the record." & vbCrLf & _
vbCrLf & "Click NO to Cancel" & vbCrLf & vbCrLf & _
"Click YES to continue", vbYesNo, "Change record ?") = vbNo Then
Me.NameOfComboBox.Undo
Cancel = True
End If

End Sub
 
Hi Douglas

yes you are right I forgot the last section - LoL what-do-I-know

maybe shouldn't write on this thing at half past 10 at night :-)
 
Thank you immensely!

Douglas J. Steele said:
I think you need a little more than that, Wayne.

Private Sub NameOfComboBox_BeforeUpdate(Cancel As Integer)

If MsgBox("Are you really sure you want to alter this record?" & _
vbCrLf & vbCrLf & "This will update the record." & vbCrLf & _
vbCrLf & "Click NO to Cancel" & vbCrLf & vbCrLf & _
"Click YES to continue", vbYesNo, "Change record ?") = vbNo Then
Me.NameOfComboBox.Undo
Cancel = True
End If

End Sub
 
Back
Top