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  

Parameter Query and a report



 
 
Thread Tools Display Modes
  #1  
Old January 23rd, 2007, 11:09 PM posted to microsoft.public.access.gettingstarted
skr
external usenet poster
 
Posts: 17
Default Parameter Query and a report

I am working on a database for investments. The customer would like to be
able to enter a date range and see which investments are due to mature. I've
set up a paramter query for this. The problem is when there is no
investments they would still like a report to print out that has the date
range entered by a message that says "no investments for this time period"
and no data.

I'm hoping somebody can help. I'm sure this is probably an easy fix but
I've search all over for the answer and don't seem to be finding it.!

Thanks
  #2  
Old January 23rd, 2007, 11:29 PM posted to microsoft.public.access.gettingstarted
Mike Revis
external usenet poster
 
Posts: 24
Default Parameter Query and a report

Not sure if this will work for you but if you look at the report property
sheet there is an "On No Data" event.

Mike

"skr" wrote in message
...
I am working on a database for investments. The customer would like to be
able to enter a date range and see which investments are due to mature.

I've
set up a paramter query for this. The problem is when there is no
investments they would still like a report to print out that has the date
range entered by a message that says "no investments for this time period"
and no data.

I'm hoping somebody can help. I'm sure this is probably an easy fix but
I've search all over for the answer and don't seem to be finding it.!

Thanks



  #3  
Old January 24th, 2007, 03:12 AM posted to microsoft.public.access.gettingstarted
fredg
external usenet poster
 
Posts: 4,386
Default Parameter Query and a report

On Tue, 23 Jan 2007 15:09:06 -0800, skr wrote:

I am working on a database for investments. The customer would like to be
able to enter a date range and see which investments are due to mature. I've
set up a paramter query for this. The problem is when there is no
investments they would still like a report to print out that has the date
range entered by a message that says "no investments for this time period"
and no data.

I'm hoping somebody can help. I'm sure this is probably an easy fix but
I've search all over for the answer and don't seem to be finding it.!

Thanks


1) You'll need to use a form to enter the parameters in, not the
parameter prompt you get from the query

Create an unbound form.
Add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

As criteria in the query date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

Code the report's Close event:
DoCmd.Close acForm, "ParamForm"

Add a Label to your report.
"No investments for the period of " & forms!ParamForm!StartDate & "
and " & forms!ParamForm!EndDate & " whatever else you wish to
display."
Make this label not visible.
Name it "lblNoData"

Code the Report's OnNoData event:
lblNoData.Visible = True

When ready to run the report, open the report.
The form will open and wait for the selection of the Company and the
entry of the starting and ending dates wanted.
Click the command button and then report will run.
If there is no data the label will print.
When the report closes, it will close the form.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 




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


All times are GMT +1. The time now is 09:37 PM.


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