A
Afrosheen via AccessMonster.com
Good morning everyone.
I'm trying to use the limit to list as a sub routine. Here is the code:
Private Sub cklist()
10 On Error GoTo Combo38_NotInList_Error
20 intAnswer = MsgBox("The " & cbolist & " " & Chr(34) & NewData & _
Chr(34) & " is not currently listed." & vbCrLf & _
"Would you like to add it to the list now?" _
, vbQuestion + vbYesNo, "Item Entry")
30 If intAnswer = vbYes Then
40 'strSQL = "INSERT INTO current location([currlocn]) " & _
"VALUES ('" & NewData & "');"
50 DoCmd.SetWarnings False
60 DoCmd.RunSQL strSQL
70 DoCmd.SetWarnings True
80 MsgBox "The new " & cbolist & " has been added to the list." _
, vbInformation, "Item Entry"
90 Response = acDataErrAdded
100 Else
110 MsgBox "Please choose a " & cbolist & " from the list." _
, vbInformation, "Item Entry"
120 Response = acDataErrContinue
130 End If
End Sub
What is happening is that I'm getting an error on line 90 and probably on
line 120. Those lines have "Response" and the error code is telling me that
the variable was not found.
I'm trying use this for about 3-4 combo boxes. As I step through the code
everything else seems to work ok. The string strSQL, newdata, and cbolist are
set up as strings and intAnswer As Integer.
Can I use the Not in List like this or do I have to use it separately?
Thanks for your input and help.
I'm trying to use the limit to list as a sub routine. Here is the code:
Private Sub cklist()
10 On Error GoTo Combo38_NotInList_Error
20 intAnswer = MsgBox("The " & cbolist & " " & Chr(34) & NewData & _
Chr(34) & " is not currently listed." & vbCrLf & _
"Would you like to add it to the list now?" _
, vbQuestion + vbYesNo, "Item Entry")
30 If intAnswer = vbYes Then
40 'strSQL = "INSERT INTO current location([currlocn]) " & _
"VALUES ('" & NewData & "');"
50 DoCmd.SetWarnings False
60 DoCmd.RunSQL strSQL
70 DoCmd.SetWarnings True
80 MsgBox "The new " & cbolist & " has been added to the list." _
, vbInformation, "Item Entry"
90 Response = acDataErrAdded
100 Else
110 MsgBox "Please choose a " & cbolist & " from the list." _
, vbInformation, "Item Entry"
120 Response = acDataErrContinue
130 End If
End Sub
What is happening is that I'm getting an error on line 90 and probably on
line 120. Those lines have "Response" and the error code is telling me that
the variable was not found.
I'm trying use this for about 3-4 combo boxes. As I step through the code
everything else seems to work ok. The string strSQL, newdata, and cbolist are
set up as strings and intAnswer As Integer.
Can I use the Not in List like this or do I have to use it separately?
Thanks for your input and help.