I have to run the following codes in the After Update Event for a number of form fields and can not figure out what varible type to declare in the user defined sub routine. The procedure is the same except that the field name should be a variable.
Private Sub ContractorType_AfterUpdate()
Dim strMsg As String
Dim intchoice As Integer
strMsg = "Do something ......Select OK or Cancel" _
intchoice = MsgBox(strMsg, vbOKCancel, "Message Alert")
If intchoice = vbOK Then ' do nothing
Exit Sub
Else
intchoice = vbCancel
Me.ContractorType.Value = Me.ContractorType.OldValue
Me.ContractorType.SetFocus
End If
End Sub
I tried set up a Sub AlertMsg(Fld As Field) and call this routine from the AfterUpdate event of other fields, say Call AlertMsg(Me!FieldA) but it did not work. Can anyone help me out on this?
Thanks a bunch.
Private Sub ContractorType_AfterUpdate()
Dim strMsg As String
Dim intchoice As Integer
strMsg = "Do something ......Select OK or Cancel" _
intchoice = MsgBox(strMsg, vbOKCancel, "Message Alert")
If intchoice = vbOK Then ' do nothing
Exit Sub
Else
intchoice = vbCancel
Me.ContractorType.Value = Me.ContractorType.OldValue
Me.ContractorType.SetFocus
End If
End Sub
I tried set up a Sub AlertMsg(Fld As Field) and call this routine from the AfterUpdate event of other fields, say Call AlertMsg(Me!FieldA) but it did not work. Can anyone help me out on this?
Thanks a bunch.