I am trying to add data to a combo box on the fly using Docmd but seem to be running into an error that I cannot find an answer to.
The debug message says "Runtime error '3464':
Data type mismatch in criteria expression.
The code that gets highlight during debugging is:
I think my issue is either the ID,Discrepancy or NewData, but I cannot seem to get the right combination to make it work.
Any help would be appreciated
Thx,
Michael
Code:
Private Sub Descrepancy_NotInList(NewData As String, Response As Integer)
intAnswer = MsgBox("The Discrepancy " & Chr(34) & NewData & _
Chr(34) & " is not currently listed." & vbCrLf & _
"Would you like to add it to the list now?" _
, vbQuestion + vbYesNo, "")
If intAnswer = vbYes Then
DoCmd.RunSQL "INSERT INTO Discrepancy_Choices (ID,Discrepancy) " & "VALUES ('" & NewData & "','');"
MsgBox "Addition completed.", vbInformation, ""
Response = acDataErrAdded
Else
MsgBox "Please choose a Discrepancy from the list." _
, vbInformation, ""
Response = acDataErrContinue
End If
End Sub
The debug message says "Runtime error '3464':
Data type mismatch in criteria expression.
The code that gets highlight during debugging is:
Code:
DoCmd.RunSQL "INSERT INTO Discrepancy_Choices (ID,Discrepancy) " & "VALUES ('" & NewData & "','');"
I think my issue is either the ID,Discrepancy or NewData, but I cannot seem to get the right combination to make it work.
Any help would be appreciated
Thx,
Michael