MackMan
Registered User.
- Local time
- Today, 15:30
- Joined
- Nov 25, 2014
- Messages
- 174
I need some help with something I'm obviously doing wrong...
I have several forms where the user can input supplier details (which use the same table) so I'm trying to use a public function to do this.
However when I call the code, I get an "Argument Not Optional" message.
The public sub is... (which is option explicit)
on the form that triggers the event is (also option explicit)
What's happened? I know I'm missing an optional arg, but don't know what it is?
As always, advise always appreciated.
I have several forms where the user can input supplier details (which use the same table) so I'm trying to use a public function to do this.
However when I call the code, I get an "Argument Not Optional" message.
The public sub is... (which is option explicit)
Code:
Public Sub gcboPayeeSelectNotInListEvent(NewData As String, Response As Integer)
Dim intAnswer As Integer
Dim strSQL As String
On Error GoTo cboPayeeSelectNotInList_Err
intAnswer = MsgBox("The Payee " & Chr(34) & NewData & Chr(34) & " is not currently listed." & vbCrLf & "Would you like to add it now?", vbQuestion + vbYesNo, "Unrecognised Payee.")
If intAnswer = vbYes Then
strSQL = "INSERT INTO tbl_Payees([PayeeName]) " & _
"VALUES ('" & NewData & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
MsgBox "The new Payee has been added to the list." & _
" Please enter remaining information" & vbCrLf & _
"before proceeding further" _
, vbInformation, "More data required..."
Response = acDataErrAdded
DoCmd.OpenForm "frmPAYEESAddEdit", acNormal, , "Payeename= """ & Me.cboPayeeSelect.Text & """"
Form_frmPAYEESAddEdit.Caption = "Add details for Payee : " & Me.cboPayeeSelect.Text
Form_frmPAYEESAddEdit.lblTitle.Caption = "ADD PAYEE : " & Me.cboPayeeSelect.Text
Else
MsgBox "Please choose a Payee from the list." _
, vbInformation, "Please choose..."
Response = acDataErrContinue
End If
cboPayeeSelectNotInList_Exit:
Exit Sub
cboPayeeSelectNotInList_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume cboPayeeSelectNotInList_Exit
End Sub
Code:
Private Sub cboPayeeSelect_NotInList(NewData As String, Response As Integer)
gcboPayeeSelectNotInListEvent
End Sub
As always, advise always appreciated.
Last edited: