First, you changed the field name:
Code:
tblDriver has IDDriver Surname NameFirst
frmMain has control DriverFK (combo box) Properties are
Control Source DriverFK
Row Source SELECT tblDriver.IDDriver, [Surname] & ", " & [FirstName] AS Driver FROM tblDriver ORDER BY [Surname] & ", " & [FirstName];
Don't know what these are:
Code:
Allow v l edits No
Format Props
The name of the record set is not the same:
Code:
Dim strMsg As String, rst As Recordset, db As Database
.
.
Set rs = db.OpenRecordset("tblDriver", dbOpenDynaset)
rs.AddNew
rs![DriverFK] = NewData
rs.Update
rs.Close
Set rs = Nothing
In the NotInList event, NewData will (should) contain the data that you want entered in a table as a new record. You have two fields for the name, "Surname" & "NameFirst"; but NewData is only one concatenated piece of data. Then you are trying to store text in a number field:
Code:
rs![DriverFK] = NewData
In the NotInList event, it will ALWAYS try to add a new record to "tblDriver" because you don't have a response from the msgbox function. It should look something like:
Code:
If MsgBox(strMsg, intButtons, strTitle) = vbNo Then
The setting that indicates how the NotInList event was handled is missing.
See the "NotInList Event"in help...