I've got this code from other source for the "Not in list" for combo box
code:
Dim ctl As Control
Dim strSQL As String
Set ctl = Me!AssetType
If MsgBox("Value is not in list. Add it?", _
vbOKCancel) = vbOK Then
Response = acDataErrAdded
strSQL = "INSERT INTO tbleAssettype(list) VALUES('"
strSQL = strSQL & NewData & "');"
CurrentDb.Execute strSQL
Else
Response = acDataErrContinue
ctl.Undo
End If
-
I get error message "runtime error 3192"
My table has to fields
1. assetid - primary but not autonumber just number
2. assetdesc
code:
Dim ctl As Control
Dim strSQL As String
Set ctl = Me!AssetType
If MsgBox("Value is not in list. Add it?", _
vbOKCancel) = vbOK Then
Response = acDataErrAdded
strSQL = "INSERT INTO tbleAssettype(list) VALUES('"
strSQL = strSQL & NewData & "');"
CurrentDb.Execute strSQL
Else
Response = acDataErrContinue
ctl.Undo
End If
-
I get error message "runtime error 3192"
My table has to fields
1. assetid - primary but not autonumber just number
2. assetdesc