Okay, thanks for posting the code, now I can help. The immediate problem
with the DLookup is you have the arguments in the wrong positions. Now, the
real problem is you are doing things in the wrong places. For what you are
doing, the before update event is not the place to do it. Part of your code
belongs in the After Update event and the rest of it belongs in the Not In
List Event. Here is a rewrite that shows how it should be done. First, you
use the combo's After Update event to make the record for the selected Agent
the currrent record for the form. When the Agent selected is not in the
combo's row source, you use the combo's Not In List event to give the user
the option to either add the Agent or cancel the selection and choose another:
Private Sub Combo28_AfterUpdate()
If Not IsNull(Me.Combo28) Then
With Me.RecordsetClone
.FindFirst "[Agent] = '" & Me.Combo28
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End If
End sub
-------------
Private Sub Combo28_NotInList(NewData As String, Response As Integer)
Dim strSql As String
If MsgBox(NewData & " Is Not Currently in the List" & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
Me.Combo28 = Me.Combo28.OldValue
CurrentDb.Execute ("INSERT INTO Agent([Agent]) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Response = acDataErrAdded
Me.Combo28.Requery
Else
Response = acDataErrContinue
End If
End Sub
[quoted text clipped - 41 lines]