Hi i've created a simple form with a combo box, using wizard, and i create this code. for to add items when isnotinlist event.
after requery, old data are changed to primary id numbers/.
Eg
Nametxt, id=1
Surnamext, id=2
Agetxt id =3
When i add a new item
the first item nametxt, converts to 1. This is the id
here is the code
Dim cnn1 As ADODB.Connection
Set cnn1 = CurrentProject.Connection
Dim rs As New ADODB.Recordset
rs.ActiveConnection = cnn1
rs.Open " SELECT * from affectiontbl ", cnn1, adOpenDynamic, adLockPessimistic
Dim strMsg As String
strMsg = "'" & NewData & "' msg " & vbCrLf & vbCrLf
strMsg = strMsg & "msg;"
strMsg = strMsg & vbCrLf & vbCrLf & "msg"
If MsgBox(strMsg, vbQuestion + vbYesNo, "msg;") = vbNo Then
Response = acDataErrContinue
Else
rs.AddNew
rs!data = NewData
rs.Update
Response = acDataErrAdded
End If
rs.Close
Set rs = Nothing
Set cnn1 = Nothing