Message required

  • Thread starter Thread starter Mazza
  • Start date Start date
M

Mazza

I have a continuous form which has a search function. What I would like is a
message to appear when you search and no records are found telling the user
that their search returned nothing instead of a blank form.
Any help would be greatly appreciated
Mazza
 
Mazza,
Consider a Find that won't allow the user to even look for a value that does not exist.
Let's say you'd like to locate an OrderNo. If you provide the user with a combo box
populated with only legitimate "existing" OrderNos, and set the LimitToList to YES, then
the user can never search for an OrderNo that does not exist.
 
Let me know if this helps. This is kind of cheezy, but it seems to work:

Me.SearchField.SetFocus
DoCmd.FindRecord SearchVal

If SearchVal <> Me.ActiveControl Then
MsgBox "record not found"
End If
 
Thank you Al not a bad idea I will restructure the form and give it a try
Mazza
 
If you are searching for values like OrderNo, like Al suggests, then
something like this should help.

Private Sub cmbFindContact_AfterUpdate()

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[AppearanceID] = " & Str(Nz(Me![cmbFindContact], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub

Otherwise, if you're searching for stray words in MEMO fields, you might try
my workaround, if you don't find anything else.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top