A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I report no data found in query, other than a blank page?



 
 
Thread Tools Display Modes
  #1  
Old January 30th, 2006, 05:40 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default How do I report no data found in query, other than a blank page?

I am writting a general query builder and need to report to the user that
their query did not return any records. Just a blank piece of paper in not
acceptable.
  #2  
Old January 30th, 2006, 07:09 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default How do I report no data found in query, other than a blank page?

You may want to put a function behind your form ....

(untested but it would be similar)
Private Sub myReport OnLoad()
If myRS.EOF Then
MsgBox "There were no results for this query. Please try again with
more data"
DoCmd.Close acReport, "MyReport"
End If
End Sub

hth

  #3  
Old January 30th, 2006, 07:16 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default How do I report no data found in query, other than a blank page?

Or, use the OnNoData event of the report.


Private Sub Report_NoData(Cancel As Integer)
MsgBox "This report contains no data"
Cancel = True
End Sub


You might get an error on the line of code that you used to open the
report.


Chris Nebinger

  #4  
Old January 30th, 2006, 07:27 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default How do I report no data found in query, other than a blank page?

You can also (depending on you application), catch the error before the
report is run by checking the query for records:

If (CurrentDb.OpenRecordset("Query2").RecordCount = 0) Then
MsgBox ("There are no records available")
Else
open query or report
End If

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...arted/200601/1
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PST file has reached maximum size Jeff C General Discussion 2 October 6th, 2005 01:35 PM
How do I save an access document in word document? cmartin General Discussion 2 September 13th, 2005 11:26 PM
Error when running Query, but not Report Blaze Running & Setting Up Queries 29 September 9th, 2005 05:40 AM
Still Hoping for help with a Query problem Don Sealer Using Forms 15 November 13th, 2004 06:24 AM
Union Query Not Returning A Value Jeff G Running & Setting Up Queries 2 October 19th, 2004 05:47 PM


All times are GMT +1. The time now is 06:24 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.