Display Parameter Values in Report When No Rows are Returned

lmoseley7

Board Regular
Joined
Jul 9, 2013
Messages
151
Let me start by saying I am an Access novice, but I'm pretty knowledgeable about Excel so I'm comfortable with formulas, functions and VBA to an extent. I have an Access report that I run that has a parameter on the query that attempts to match maturity dates to transactions in the table. So if you wanted to know what securities are scheduled to mature tomorrow, you would enter tomorrow's date. The problem comes up when there are no items maturing on the selected date. The date entered in the prompt will not appear in the report. There is no error, it is just blank. I need to know that the report was run for the correct date when I am reviewing other's work, but the date will not appear. How can I get this to appear when no activity is returned? I am using the following in a text box to get the parameter date when activity is returned:
=Reports![Maturities On This Date]![Enter Maturity Date]

Thanks in advance.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi,
The date should be part of the report too. For instance, in the report header.
 
Upvote 0
I was able to accomplish what I needed by running the report from a form where I can pull the date value even when no data is returned. It took quite a bit more work than what I was hoping, but if there is no other way, I guess I'll take it. I'm still open to simpler methods however.
 
Upvote 0
One way, if you want to "capture" parameters input and display them on your Report is to have a Form where you enter the Report Parameters and then call the Report.
I make this Form abound to a single-line Table for the sole purpose of storing the parameters I input into a single-line table (if you set the Form to not allow new record creation or record deletion, you can always make sure it is exactly one line).

Then, include this one-line table in the Query that your Report is based on (or use DLOOKUPs). Then those entered parameters are available to you to display on your Report.
 
Upvote 0
Another way to skin this cat is to open the report with OpenArgs since we're only talking one parameter and it's in the header. In the report LoadEvent, set the value of a control or caption of a label to include the date that was passed to the report as an OpenArg.
e.g. code that opens the report where the date is in txtDate:
Code:
DoCmd.OpenReport("ReportName"),,,,,Me.txtDate
In the report LoadEvent
Code:
Me.lblDateParam.Caption = "Date Selected For Report: " & Me.OpenArgs
OR
Code:
Me.txtDateParam = "Date Selected For Report: " & Me.OpenArgs
To see if you need any of the parameters applicable to the DoCmd method, Google DoCmd.OpenReport
 
Upvote 0
One way, if you want to "capture" parameters input and display them on your Report is to have a Form where you enter the Report Parameters and then call the Report.
I make this Form abound to a single-line Table for the sole purpose of storing the parameters I input into a single-line table (if you set the Form to not allow new record creation or record deletion, you can always make sure it is exactly one line).

Then, include this one-line table in the Query that your Report is based on (or use DLOOKUPs). Then those entered parameters are available to you to display on your Report.

I appreciate the ideas for controlling input. If time allows me to research and learn Access, I'm sure that will come in handy.
 
Upvote 0
Another way to skin this cat is to open the report with OpenArgs since we're only talking one parameter and it's in the header. In the report LoadEvent, set the value of a control or caption of a label to include the date that was passed to the report as an OpenArg.
e.g. code that opens the report where the date is in txtDate:
Code:
DoCmd.OpenReport("ReportName"),,,,,Me.txtDate
In the report LoadEvent
Code:
Me.lblDateParam.Caption = "Date Selected For Report: " & Me.OpenArgs
OR
Code:
Me.txtDateParam = "Date Selected For Report: " & Me.OpenArgs
To see if you need any of the parameters applicable to the DoCmd method, Google DoCmd.OpenReport

I will look into OpenArgs and see how they may be able to help me in the future. Thanks for the suggestion.
 
Upvote 0

Forum statistics

Threads
1,221,713
Messages
6,161,463
Members
451,708
Latest member
PedroMoss2268

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top