I have a form and displayed in it is a subform. I created a macro to put a datestamp on any record that is changed.
It works fine for records edited using the main form. When I try to run the same macro in the subform I get error 2950; ActionName: SetValue, Arguments: [Date Modified], Date()
Here's my code:
I have a listbox on the main form so the user can search for records. Ideally it would be nice if the user was asked whether to save or not when they go to change records or close the form. At the moment, each time the user switches between the form and subform, they are prompted to save (if any data is changed).
It works fine for records edited using the main form. When I try to run the same macro in the subform I get error 2950; ActionName: SetValue, Arguments: [Date Modified], Date()
Here's my code:
Code:
Option Compare Database
Private Sub Form_BeforeUpdate(Cancel As Integer)
Resp = MsgBox("Do you wish to save the new/edited data?", vbYesNo + vbQuestion, "Unsaved Data")
If Resp = vbNo Then
Me.Undo
Else
DoCmd.RunMacro "Last Modified"
End If
End Sub
I have a listbox on the main form so the user can search for records. Ideally it would be nice if the user was asked whether to save or not when they go to change records or close the form. At the moment, each time the user switches between the form and subform, they are prompted to save (if any data is changed).