S
shymousee
I am trying to use one table with multiple fields in a notinlist pop up. The
name of the table is equipment. It has 2 fields in it, equipment and toners.
No matter what I try, I get an error message saying the item is not on the
list. If I change the statement
strSQL = "INSERT INTO equipment([equipment]) " & _
"VALUES ('" & NewData & "');"
to
strSQL = "INSERT INTO equipment([toners]) " & _
"VALUES ('" & NewData & "');"
I get the message, The text you entered isn't an item in the list. Select
an item from the list, or enter text that matches one of the listed items.
This is after I get a message saying the item was added.
I am trying to combine some tables instead of having a bunch of tables for
each time I want to use the notinlist option.
Private Sub toner_NotInList(NewData As String, Response As Integer)
On Error GoTo equipment_NotInList_Err
Dim intAnswer As Integer
Dim strSQL As String
intAnswer = MsgBox("The equipment " & Chr(34) & NewData & _
Chr(34) & " is not currently listed." & vbCrLf & _
"Would you like to add it to the list now?" _
, vbQuestion + vbYesNo, "property")
If intAnswer = vbYes Then
strSQL = "INSERT INTO equipment([equipment]) " & _
"VALUES ('" & NewData & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
MsgBox "The new equipment has been added to the list." _
, vbInformation, "property"
Response = acDataErrAdded
Else
MsgBox "Please choose a equipment from the list." _
, vbInformation, "property"
Response = acDataErrContinue
End If
equipment_NotInList_Exit:
Exit Sub
equipment_NotInList_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume equipment_NotInList_Exit
End Sub
name of the table is equipment. It has 2 fields in it, equipment and toners.
No matter what I try, I get an error message saying the item is not on the
list. If I change the statement
strSQL = "INSERT INTO equipment([equipment]) " & _
"VALUES ('" & NewData & "');"
to
strSQL = "INSERT INTO equipment([toners]) " & _
"VALUES ('" & NewData & "');"
I get the message, The text you entered isn't an item in the list. Select
an item from the list, or enter text that matches one of the listed items.
This is after I get a message saying the item was added.
I am trying to combine some tables instead of having a bunch of tables for
each time I want to use the notinlist option.
Private Sub toner_NotInList(NewData As String, Response As Integer)
On Error GoTo equipment_NotInList_Err
Dim intAnswer As Integer
Dim strSQL As String
intAnswer = MsgBox("The equipment " & Chr(34) & NewData & _
Chr(34) & " is not currently listed." & vbCrLf & _
"Would you like to add it to the list now?" _
, vbQuestion + vbYesNo, "property")
If intAnswer = vbYes Then
strSQL = "INSERT INTO equipment([equipment]) " & _
"VALUES ('" & NewData & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
MsgBox "The new equipment has been added to the list." _
, vbInformation, "property"
Response = acDataErrAdded
Else
MsgBox "Please choose a equipment from the list." _
, vbInformation, "property"
Response = acDataErrContinue
End If
equipment_NotInList_Exit:
Exit Sub
equipment_NotInList_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume equipment_NotInList_Exit
End Sub