Ken,
Here is the code that initiates the Error Message
Form "IDDoesNotExist":
Private Sub FindCustID_Click()
On Error GoTo Err_FindCustID_Click
Dim stDocName As String
Dim count As Variant
Dim stLinkCriteria As String
stDocName = "CustDetailsTableInputFormUPDATE"
count = DCount("[CUST ID]", "CustDetailsTable", "[CUST
ID]=" & Me![Text1])
stLinkCriteria = "[CUST ID]=" & Me![Text1]
If count = 1 Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize
DoCmd.Close acForm, "Switchboard"
DoCmd.Close acForm, "FindCustID"
ElseIf count = 0 Then
DoCmd.OpenForm "IDDoesNotExist"
End If
Exit_FindCustID_Click:
Exit Sub
Err_FindCustID_Click:
MsgBox Err.Description
Resume Exit_FindCustID_Click
End Sub
Here is the code for the Error Message
Form "IDDoesNotExist":
Private Sub OK_Click()
On Error GoTo Err_OK_Click
DoCmd.Close
Exit_OK_Click:
Exit Sub
Err_OK_Click:
MsgBox Err.Description
Resume Exit_OK_Click
End Sub
Thanks!!!
Jeff M
>-----Original Message-----
>A form does not get focus unless there is no control on the form that can
[quoted text clipped - 22 lines]
>
>.
Ken Snell [MVP] - 31 Mar 2005 19:29 GMT
Just need an extra step in the If block to reset the focus to the textbox:
If count = 1 Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize
DoCmd.Close acForm, "Switchboard"
DoCmd.Close acForm, "FindCustID"
ElseIf count = 0 Then
DoCmd.OpenForm "IDDoesNotExist"
Me.Text1.SetFocus
End If

Signature
Ken Snell
<MS ACCESS MVP>
> Ken,
> Here is the code that initiates the Error Message
[quoted text clipped - 83 lines]
>>
>>.