well i came up with a work around and it seems to be working the way i would like it too. but i'm not sure if this would be the best way to write the code. but i'm posting it and maybe someone can tell me if there are problems with it that is obvious that i cant see.
Private Sub cmbClientID_NotInList(NewData As String, Response As Integer)
Dim strName As String, strWhere As String
' User typed in a contact type that's not in the list
strName = NewClient
' Build the verification search string
strWhere = "[Client] = '" & strName & "'"
' Verify that they want to add the new Client
If vbYes = MsgBox("The Customer " & NewClient & " is not in the system. " & _
"Do you want to add this Customer?", vbYesNo + vbQuestion + vbDefaultButton1, gstrAppTitle) Then
' Open the add a Client form and pass it the new value
' NOTE: For this simple lookup value we could do an SQL Insert,
' but this method gives the user one extra chance to verify the value.
DoCmd.OpenForm "F_Client", DataMode:=acFormAdd, WindowMode:=acDialog, _
OpenArgs:=strName
' Customer Added - Tell Access so that combo gets requeried
Response = acDataErrAdded
Else
' Don't want to add what they typed - show standard error message
Response = acDataErrDisplay
End If
End Sub
let me know if you see any problems with using this. like i said its working exactly the way i need it to, but i like things to be perfect as much as possible and dont want to end up with some major headaches down the road. :)
|