C
chriswinter
I am looking for code help to have a not in list event call up a form.
What my current code is the following: What I want to be able to do is
have it open my form that is frmRequestingAgency. Right now it will
add the Requesting Agency name, but in the actual table or form there
is alot of other info that needs to be filled in.
Private Sub Service_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String
'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "'" & NewData & "' Is not in the Database!" & vbCr & vbCr
Msg = Msg & "Do you want to add it?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Book Category...")
If i = vbYes Then
strSQL = "Insert Into tblRequestingAgency ([AgencyName]) " & _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
What my current code is the following: What I want to be able to do is
have it open my form that is frmRequestingAgency. Right now it will
add the Requesting Agency name, but in the actual table or form there
is alot of other info that needs to be filled in.
Private Sub Service_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String
'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "'" & NewData & "' Is not in the Database!" & vbCr & vbCr
Msg = Msg & "Do you want to add it?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Book Category...")
If i = vbYes Then
strSQL = "Insert Into tblRequestingAgency ([AgencyName]) " & _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub