padlocked17
Registered User.
- Local time
- Yesterday, 22:17
- Joined
- Aug 29, 2007
- Messages
- 275
Just as the title describes, I need to figure out how to replace "Me" in a public function.
The code is below and I need to rereference where Me.Undo is to something that will work for each instance on every form where I call this public Error Checking function.
The code is below and I need to rereference where Me.Undo is to something that will work for each instance on every form where I call this public Error Checking function.
Code:
For Each ctl In TheForm
If ctl.Tag = "Required" Then
If ctl = "" Or IsNull(ctl) Then
Num = 1
Exit For
End If
End If
Next ctl
'Oops, looks like the user missed a field
If Num = 1 Then
If MsgBox("Data is required in " & ctl.Name & "," & vbCrLf & _
"You haven't entered required data. Do you want to enter it now?", vbQuestion + vbYesNo, "Required information") = vbYes Then
Else
'This will delete all changes on the form to a before "dirty" state
'Make sure it will Undo AND not allow a form to close without discarding changes
[COLOR="Red"]Me.Undo[/COLOR]
'Forms(Screen.ActiveForm).Undo
End If
RequiredData = True
Else
RequiredData = False
End If