Errors

peterbowles

Registered User.
Local time
Today, 20:54
Joined
Oct 11, 2002
Messages
163
I am filtering a form. if the user searches for a name that is not in the database the main form returns blank.

How do I show a message box to say the no records were found if there were none.

Also I am using this code to search records via a customer name.

FilterString = ""
If Chkname Then

FilterString = FilterString & "CustomerName Like """ & Me!txtname & """"
End If

how do I search for records that contain certain letters in the customer name


Cheers
 
Count the records in the table based on your filter criteria before you apply the filter. Here is an example on how I once did it...
Code:
If DCount("[MyField]", "MyTable", "[MyField] = -1") = 0 Then
    MsgBox "There is nothing to filter since there are no records selected as 'Yes' to research."
    Me.FilterOn = False
    Exit Sub
Else
    'MsgBox "More than zero Yes records to research."
    DoCmd.ApplyFilter , cbFilterType & " = " & cbFilterCriteria
End If
 

Users who are viewing this thread

Back
Top Bottom