N
NoodNutt
Hi ppl,
I am using Acc2003, which I have just upgraded to from Acc97 (Finally).
I have this code in a combo which is in a subform
worked fine in Acc97, although this particular code wasn't used in a subform
configuration.
Appreciate any assistance or suggestions
TIA
Mark
Private Sub cmbContainer_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database, rs As DAO.Recordset, strMsg As String
strMsg = NewData & " is not listed ! Do you want to add it ?"
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add New Container ?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblContainers", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!ContainerNo = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
End Sub
I am using Acc2003, which I have just upgraded to from Acc97 (Finally).
I have this code in a combo which is in a subform
worked fine in Acc97, although this particular code wasn't used in a subform
configuration.
Appreciate any assistance or suggestions
TIA
Mark
Private Sub cmbContainer_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database, rs As DAO.Recordset, strMsg As String
strMsg = NewData & " is not listed ! Do you want to add it ?"
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add New Container ?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblContainers", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!ContainerNo = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
End Sub