Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Search Box - Displaying message if record not found

Status
Not open for further replies.
Joined
Jun 16, 2005
Messages
12
Location
US
I have a combo box that is used to search for a particular vendor. I want to display a simple Message box if the record is not found. How would I do that?

Below is the code that does the searching. It was created using the Combo Box Wizard.

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Client Number] = '" & Me![Combo63] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
SendKeys "{f6}", True
DoCmd.GoToControl "Provsvc"
DoCmd.GoToRecord , , acNewRec


Thanks for the help
 
If rs.EOF Then
MsgBox "Record not found"
Else
Me.Bookmark = rs.Bookmark
SendKeys "{f6}", True
DoCmd.GoToControl "Provsvc"
DoCmd.GoToRecord , , acNewRec
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I tried your solution (which was similar to one I tried earlier) without success. The focus simply moves to the assigned field (Provsvc) without displaying any message.

Is there another approach perhaps?
 
And this ?
If rs.NoMatch Then
MsgBox "Record not found"
Else
Me.Bookmark = rs.Bookmark
SendKeys "{f6}", True
DoCmd.GoToControl "Provsvc"
DoCmd.GoToRecord , , acNewRec
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Bingo! That worked. I greatly appreciate it.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top