473,231 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Printing No Records Found

I am new to this. Someone please help.

I am creating stored procedures that queries the tables to pull certain information together in a listing (report). I would like to be able to print to the user "No records found", if no records were found based on the search criteria. I can able to query the information, but can't get the "No records found" to print. The listing just comes back with no records.

Is there a canned syntax/statement to make this happen and should it be placed before or after the select statement?

Is there some sort of end of file checking that needs to happen?
Aug 7 '06 #1
2 3922
try an IF ELSE query

EXAMPLE

IF (there are records) { DO SOMETHING
} ELSE {
DO SOMETHING ELSE
}

you can expand on this by using ELSEIF instead of the first ELSE statement as long as you finish the whole thing with an ELSE statement

hope this helps
Aug 7 '06 #2
Thank you. I have been using the if, else statement. It seems to work in some of my stored procedures, but not the others. Here is a sample of what I have done. Any more suggestions?

Begin
If Exists (select 1 from table_name, table_name1
where table_name.field name = table name1.field_name)

Begin
Select .......
End
ELSE

begin
print ' no records found'
return
end
end
Aug 9 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: James | last post by:
We have a page that reads records from a database and displays them. Basically name/address/city/state/zip/county/phone. These records are between 4-6 lines a piece (there are other variables...
1
by: Earl Anderson | last post by:
Using WinXP & AccessXP, I'd like to automatically have the records that I've just printed in a report automatically updated to have the 'print date & time' immediately inserted into a 'Date/Time'...
5
by: Tom | last post by:
I have a subreport that can contain one or two pictures per page. The subreport is similar to an appendix to the main report. The recordsource contains a field "IncludeInReport" (Yes/No) for each...
1
by: John | last post by:
I am printing a very basic report with a detail section from a query. When the detail prints out everything is duplicated. For example, if there should be two lines, there are four due to the...
1
by: benfly08 | last post by:
Hi, I got a printing problem for my C# program. I need to pull out records from database and format them and then print them out. I used PrintDocument class and PrintPageEventHandler function...
4
by: paquer | last post by:
Hello' How do I get the subform to print along with the main form? I want my user's to be able to go in the field with a printout of the info they need to populate in the database. So when they...
1
by: paquer | last post by:
I have forms that are used in the office as well as in the field. I want user's to be able to print out an exact copy of the form for "in the field" data entry. (Yes we are still stuck in the 90's....
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
5
by: Nhoung Ar | last post by:
I am working on small database, which has a number of thousand records in one table. I need to print those (a hundred records or less) a time. I think that i should have one form for input the...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.