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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query shows blank table when no data found

Status
Not open for further replies.

h11

MIS
Jan 15, 2004
21
US
I have a query that I use to search for certain items. Is their a way I can have a message pop up saying no records found, if their is no data found.

thanks

Tim
 
How are you running the query? You can check if there are any records returned by this as the criteria to display the message box instead of opening the query.

DCount("*",YourQueryName)=0

 
Basicaly I am using just a simple query that looks like this

SELECT [TBL cac].[LAST NAME], [TBL cac].[FIRST NAME], [TBL cac].ACTIVITY, [TBL cac].LOCATION, [TBL cac].[POSITION TITLE], [TBL cac].GS, [TBL cac].SERIES, [TBL cac].appointment, [TBL cac].GRADE, [TBL cac].Smtp, [TBL cac].DIRECTORATE, [TBL cac].[Naf or APF], [TBL cac].DIVISION, [TBL cac].AKO, [TBL cac].SPONSERED, [TBL cac].[Cac Card], [TBL cac].[Cac Reader], [TBL cac].[Ako Forwarded], [TBL cac].[Cac Verified], [TBL cac].[AKO Email], [TBL cac].Completed
FROM [TBL cac]
WHERE ((([TBL cac].[LAST NAME])=[Enter Last Name]) AND (([TBL cac].LOCATION)="vicenza") AND (([TBL cac].DIRECTORATE)="dca"))
WITH OWNERACCESS OPTION;

this query filters for a certain city and prompts the user to enter a last name. I would like a msg box to prompt the user saying no data found if their is no records found with that last name. Thanks for any help would be appreciated.

Tim
 
I need to know how the user will be running the query. You can open a query using a macro or a module that you run directly or use an event on a form (e.g. clicking a button or selecting from a list of queries).

You can't have the message display if the user is running the query from the Query tab of the database window.
 
The user runs the query from a switchboard which points to form that the queries information finds. Basically I would call a search for last name inside a switchboard which then would call up the form search for last name, which is based upon a query. What I would like is that it comes back with a message if no records found is this possible. This form is just one deep nothing special.. Thanks

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top