hi,
i'm trying to make a
confirmation message that only shows up
when the user changes a value inside a form...
I want to warn the user that changes to the table
can be dangerous but i do not want to completely stop
him from making them (because changes might actually
be necessairy)
up to now, i'm coding some VBA for the "BeforeUpdate" event
i want to check the value from the table with the value in
the control field. If they are different; give the user an
warning message.
my problem is, i dont know how to get the values from the
table and form in VBA.
Here is the code i have so far
thank you
i'm trying to make a
confirmation message that only shows up
when the user changes a value inside a form...
I want to warn the user that changes to the table
can be dangerous but i do not want to completely stop
him from making them (because changes might actually
be necessairy)
up to now, i'm coding some VBA for the "BeforeUpdate" event
i want to check the value from the table with the value in
the control field. If they are different; give the user an
warning message.
my problem is, i dont know how to get the values from the
table and form in VBA.
Here is the code i have so far
Code:
Private Sub Description_BeforeUpdate(Cancel As Integer)
Dim Response, TableValue, FormValue, rec
rec = CurrentRecord
TableValue = 'value from table
FormValue = 'value from control
'My control name is "RO Number"
'My column name is "RO"
If TableValue <> FormValue Then
Response = MsgBox("You have made changes to an existing record, do you wish to save them?", vbYesNo, "Confirm changes")
If Response = vbNo Then
DoCmd.CancelEvent
DoCmd.DoMenuItem acFormBar, acEdit, acUndo
End If
End If
End Sub