I'm having problems trying to set the Not In List event of my combo box. It halts on the line DimdbsAssets as Database with the error msg compile error user-defined type not defined. Does anyone know what I need to do to correct this?
Private Sub userName_NotInList(NewData As String, Response As Integer)
' Ask the user whether to add a value to the list
Dim strMessage As String
Dim dbsAssets As Database
Dim rstUsers As Recordset
strMessage = "Are you sure you want to add '"" & NewData & -" 'to the list of Users?"
If Confirm(strMessage) Then
'open the tbl_Users table and add the NewData value.
Set dbsAssets = CurrentDb()
Set rstUsers = dbsAssets.OpenRecordset("tbl_Users"
rstUsers.AddNew
rstUsers!tbl_Users = NewData
rstUsers.Update
Response = acDataErrAdded 'requery the list
Else
Response = acDataErrDisplay 'display the error
End If
End Sub
Private Sub userName_NotInList(NewData As String, Response As Integer)
' Ask the user whether to add a value to the list
Dim strMessage As String
Dim dbsAssets As Database
Dim rstUsers As Recordset
strMessage = "Are you sure you want to add '"" & NewData & -" 'to the list of Users?"
If Confirm(strMessage) Then
'open the tbl_Users table and add the NewData value.
Set dbsAssets = CurrentDb()
Set rstUsers = dbsAssets.OpenRecordset("tbl_Users"
rstUsers.AddNew
rstUsers!tbl_Users = NewData
rstUsers.Update
Response = acDataErrAdded 'requery the list
Else
Response = acDataErrDisplay 'display the error
End If
End Sub