Hi, sorry to be bugging you (or debugging)
I am now getting the message saying that the new entry does not exist and would I like to add it, when I click it I get an error message
runtime error '3265' item not found in this collection
this is the complete code I now have
Private Sub cboShipper_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblshipper")
If MsgBox(NewData & " is not in the selection provided." & vbCrLf & vbCrLf & "Would you like to add it?", vbQuestion + vbYesNo, "Unknown data") = vbYes Then
With rs
.AddNew
.Fields("cboShipper") = StrConv(NewData, vbProperCase)
.Fields("txtAddress") = StrConv(NewData, vbProperCase)
.Fields("txtCountry") = StrConv(NewData, vbProperCase)
.Fields("txtContact") = StrConv(NewData, vbProperCase)
.Fields("txtTelephone") = StrConv(NewData, bProperCase)
.Update
.Close
End With
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
I have double and treble checked that the field names are identical to these but it still keeps giving the error
Thanks
Tig
I am now getting the message saying that the new entry does not exist and would I like to add it, when I click it I get an error message
runtime error '3265' item not found in this collection
this is the complete code I now have
Private Sub cboShipper_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblshipper")
If MsgBox(NewData & " is not in the selection provided." & vbCrLf & vbCrLf & "Would you like to add it?", vbQuestion + vbYesNo, "Unknown data") = vbYes Then
With rs
.AddNew
.Fields("cboShipper") = StrConv(NewData, vbProperCase)
.Fields("txtAddress") = StrConv(NewData, vbProperCase)
.Fields("txtCountry") = StrConv(NewData, vbProperCase)
.Fields("txtContact") = StrConv(NewData, vbProperCase)
.Fields("txtTelephone") = StrConv(NewData, bProperCase)
.Update
.Close
End With
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
I have double and treble checked that the field names are identical to these but it still keeps giving the error
Thanks
Tig