L
Loni - RWT
I copied the following code to handle "Not In List" data from another form
and changed the names and questions for this form. After doing so, when I
try to open the form I get this error message:
"The expression On Open you entered as the event property setting produced
the following error: Procedure declaration does not match description of
event or proceedure having the same name."
Here is the code:
Private Sub VendorID_BeforeUpdate(NewData As String, Response As Integer)
Dim ctrl As Control
Dim strMessage As String
Set ctrl = Me.ActiveControl
strMessage = "Is this a new vendor?"
If MsgBox(strMessage, vbYesNo + vbQuestion) = vbYes Then
DoCmd.OpenForm "frmVendor", _
datamode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
'ensure vendor has been added
If Not IsNull(DLookup("VendorID", "tblVendors", "VendorID = """ & _
NewData & """")) Then
Response = acDataErrAdded
Else
strMessage = NewData & " was not added to Vendors table."
MsgBox strMessage, vbInformation, "Warning"
Response = acDataErrContinue
ctrl.Undo
End If
Else
Response = acDataErrContinue
ctrl.Undo
End If
End Sub
What is causing this error?
Thanks!
and changed the names and questions for this form. After doing so, when I
try to open the form I get this error message:
"The expression On Open you entered as the event property setting produced
the following error: Procedure declaration does not match description of
event or proceedure having the same name."
Here is the code:
Private Sub VendorID_BeforeUpdate(NewData As String, Response As Integer)
Dim ctrl As Control
Dim strMessage As String
Set ctrl = Me.ActiveControl
strMessage = "Is this a new vendor?"
If MsgBox(strMessage, vbYesNo + vbQuestion) = vbYes Then
DoCmd.OpenForm "frmVendor", _
datamode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
'ensure vendor has been added
If Not IsNull(DLookup("VendorID", "tblVendors", "VendorID = """ & _
NewData & """")) Then
Response = acDataErrAdded
Else
strMessage = NewData & " was not added to Vendors table."
MsgBox strMessage, vbInformation, "Warning"
Response = acDataErrContinue
ctrl.Undo
End If
Else
Response = acDataErrContinue
ctrl.Undo
End If
End Sub
What is causing this error?
Thanks!