I have a lookup form that is basically one combo box that holds my user names (Combo0). I need to use the afterupdate event to open my form (frm_tc1) and filter that users records. If no records are found I need it to prompt me to add a record. If yes is selected I need it to open frm_tc1 in add format, and if no is selected I need it to go back to the switchboard menu.
Here is the code that I have so far:
Private Sub Combo0_AfterUpdate()
'On Error GoTo Err_combo0
Dim stDocName As String
Dim stLinkCriteria As String
Me![Combo0].SetFocus
DoCmd.FindRecord Me![Combo0], , True, , True
If MsgBox("User Record Not Found. Do you want to add a new record?", 4) = 6 Then
DoCmd.OpenForm "frm_tc1", acViewNormal, , , acFormAdd, acWindowNormal
Else
DoCmd.OpenForm "frm_tc1"
End If
End Sub
What am I missing? It is always prompting me to enter a new record, even if there is already one in the db.
Thanks,
Chuck
Here is the code that I have so far:
Private Sub Combo0_AfterUpdate()
'On Error GoTo Err_combo0
Dim stDocName As String
Dim stLinkCriteria As String
Me![Combo0].SetFocus
DoCmd.FindRecord Me![Combo0], , True, , True
If MsgBox("User Record Not Found. Do you want to add a new record?", 4) = 6 Then
DoCmd.OpenForm "frm_tc1", acViewNormal, , , acFormAdd, acWindowNormal
Else
DoCmd.OpenForm "frm_tc1"
End If
End Sub
What am I missing? It is always prompting me to enter a new record, even if there is already one in the db.
Thanks,
Chuck