R
Robin Chapple
I have a field [Profression] on a form which is filled from a combo
box " cboProfression "
The table is [Professions]
I am attempting to add a new profession to the table using the " Not
In list " function:
Private Sub cboProfession_NotInList(NewData As String, Response As
Integer)
Dim sMsg As String, iValid As Integer
sMsg = "'" & NewData & "' is not an existing profession in the
database" & vbCrLf _
& vbCrLf & "If you wish to add it, click OK" _
& vbCrLf & "Otherwise click Cancel"
iValid = MsgBox(sMsg, vbOKCancel, "Unknown Profession")
If iValid = vbCancel Then 'Cancel was clicked'
Response = acDataErrContinue
Else
CurrentDb.Execute "Insert into tblProfessions (Profession)" _
& "values ( '" & NewData & "')"
Response = acDataErrAdded
End If
End Sub
The new data is not added to my table and i do not get an error
message.
What have I missed?
Robin Chapple
box " cboProfression "
The table is [Professions]
I am attempting to add a new profession to the table using the " Not
In list " function:
Private Sub cboProfession_NotInList(NewData As String, Response As
Integer)
Dim sMsg As String, iValid As Integer
sMsg = "'" & NewData & "' is not an existing profession in the
database" & vbCrLf _
& vbCrLf & "If you wish to add it, click OK" _
& vbCrLf & "Otherwise click Cancel"
iValid = MsgBox(sMsg, vbOKCancel, "Unknown Profession")
If iValid = vbCancel Then 'Cancel was clicked'
Response = acDataErrContinue
Else
CurrentDb.Execute "Insert into tblProfessions (Profession)" _
& "values ( '" & NewData & "')"
Response = acDataErrAdded
End If
End Sub
The new data is not added to my table and i do not get an error
message.
What have I missed?
Robin Chapple