I know you all have had questions about the "not in list" code. I've tried to read them all and I've had this work before. The code I copied from a previous db was the following. It worked. Now I have a new db and I get an error that stops in the VBA code "User defined type not defined" and it is on the "Dim dbs As Database". Below is the code I used previously, I modified the various fields to fit my DB. See anything I'm missing in a new DB?
Thanks, surfside1
Private Sub combo_Auditor_NotInList(NewData As String, Response As Integer)
Dim intAnswer As Integer
Dim dbs As Database, rst As Recordset
intAnswer = MsgBox("Add " & NewData & " to the list of AUDITORS?", _
vbQuestion + vbYesNo)
If intAnswer = vbYes Then
' Add AUDITOR stored in NewData argument to the tbl_Auditor table.
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tbl_Auditor")
rst.AddNew
' rst!Auditor = NewData
rst!Auditor = UCase(NewData)
rst.Update
Response = acDataErrAdded
' Requery the combo box list.
Else
Response = acDataErrDisplay
' Require the user to select an existing AUDITOR.
End If
rst.Close
End Sub
Thanks, surfside1
Private Sub combo_Auditor_NotInList(NewData As String, Response As Integer)
Dim intAnswer As Integer
Dim dbs As Database, rst As Recordset
intAnswer = MsgBox("Add " & NewData & " to the list of AUDITORS?", _
vbQuestion + vbYesNo)
If intAnswer = vbYes Then
' Add AUDITOR stored in NewData argument to the tbl_Auditor table.
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tbl_Auditor")
rst.AddNew
' rst!Auditor = NewData
rst!Auditor = UCase(NewData)
rst.Update
Response = acDataErrAdded
' Requery the combo box list.
Else
Response = acDataErrDisplay
' Require the user to select an existing AUDITOR.
End If
rst.Close
End Sub