473,397 Members | 1,969 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,397 software developers and data experts.

Range dates on Acess report

I am running a report and using date ranges. I will like that when I run the report to see printed those date ranges that I enter on the parameter. Could someone assist me or direct me in the proper direction?
Thank you
Aug 22 '06 #1
8 11183
MMcCarthy
14,534 Expert Mod 8TB
If your date range parameters are being entered via a queries criteria you can't really do this. However, if you are entering your date range parameters on a form you can set up a text field on the report with a source something like this:

=Forms![FormName]![DateFrom] & " to " & Forms![FormName]![DateTo]

I am running a report and using date ranges. I will like that when I run the report to see printed those date ranges that I enter on the parameter. Could someone assist me or direct me in the proper direction?
Thank you
Aug 22 '06 #2
Could you tell me how or were do I set the parameters from the report, so the dates can be printed on the report.

Thank you very much
Jose
Aug 22 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
Create an empty form and open in design view.

Put two textboxes on the form. Put appropriate label names on the textboxes.

Right click on the first textbox and go down to the bottom of the list to Properties. The first tab is the list of Format Properties and the first item on the list is format. Change this to an appropriate date format. The standard is:

Short Date

Next click on the Data tab and go down to the Default Value property. Type in

Now()

This will set the date to todays date when the form opens.

Then go to the Other tab and change the Name property to

DateFrom

Do the same for the second text box except name it

DateTo

Then add a command button to the report. Use the wizard to indicate that you want to open the relevant report to show all records. (Don't forget to remove the Criteria from the Reports query that you are currently using to set the date range.

When the wizard closes go to the properties of the command button (right click). Go to the event tab and click on the button with the dots beside the On Click event.

The code should look something like this:

Private Sub Command1_Click()
Dim stDocName As String

stDocName = "Report Name"
DoCmd.OpenReport stDocName, acViewPreview

End Sub

You need to change it so it looks like this:

Private Sub Command1_Click()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Report Name"
stLinkCriteria = "[DateField] BETWEEN " & Me.DateFrom & " AND " & Me.DateTo
DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria

End Sub

Close and save the form with an appropriate name. Set it so that this form now opens instead of the report when the user wants to view/print the report.

As before add a textbox to your report as described in previous post.




Could you tell me how or were do I set the parameters from the report, so the dates can be printed on the report.

Thank you very much
Jose
Aug 22 '06 #4
comteck
179 100+
I'm sorry McCarthy, maybe I misunderstood what JoseCruz was looking for. But you said that you can't do this if using a query.

If you were to open the query in design mode, drag the date field down, and then in the criteria box underneath, type:

Between [Enter Start Date] and [Enter End Date]

This will prompt you for your 2 dates when opening a form that is tied to this query.

Jose, is this what you wanted to do?

comteck
Aug 23 '06 #5
MMcCarthy
14,534 Expert Mod 8TB
Hi Comtech

The problem was that JoseCruz wanted to be able to then use the dates inputed by the user to print a date range on the report.

I'm sorry McCarthy, maybe I misunderstood what JoseCruz was looking for. But you said that you can't do this if using a query.

If you were to open the query in design mode, drag the date field down, and then in the criteria box underneath, type:

Between [Enter Start Date] and [Enter End Date]

This will prompt you for your 2 dates when opening a form that is tied to this query.

Jose, is this what you wanted to do?

comteck
Aug 23 '06 #6
comteck
179 100+
That's right... and using the query should work... if I am correct in thinking this is what JoseCruz is looking for.

Anyhow, Jose... you're welcome to try either method you choose, and use the one that works best for your application.

Good Luck.
comteck
Aug 23 '06 #7
mmccarthy and comteck I thank you guys so much for your help. I tried the first method and I believe this is what I need. I am just glad that I have great responces. For a minute I thought I was going to give up. Once again thank you so much.
Jose
Aug 24 '06 #8
cconte
1
Gentelman,

In the same quote, I wrote a VB app (not VBA) that requires the user to enter a date range TO and FROM then it connects to and SQL DB and outputs some reports in Access.

How can I pass the dates TO and FROM from the VB app to the access reports?

Thanks for your help.


Create an empty form and open in design view.

Put two textboxes on the form. Put appropriate label names on the textboxes.

Right click on the first textbox and go down to the bottom of the list to Properties. The first tab is the list of Format Properties and the first item on the list is format. Change this to an appropriate date format. The standard is:

Short Date

Next click on the Data tab and go down to the Default Value property. Type in

Now()

This will set the date to todays date when the form opens.

Then go to the Other tab and change the Name property to

DateFrom

Do the same for the second text box except name it

DateTo

Then add a command button to the report. Use the wizard to indicate that you want to open the relevant report to show all records. (Don't forget to remove the Criteria from the Reports query that you are currently using to set the date range.

When the wizard closes go to the properties of the command button (right click). Go to the event tab and click on the button with the dots beside the On Click event.

The code should look something like this:

Private Sub Command1_Click()
Dim stDocName As String

stDocName = "Report Name"
DoCmd.OpenReport stDocName, acViewPreview

End Sub

You need to change it so it looks like this:

Private Sub Command1_Click()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Report Name"
stLinkCriteria = "[DateField] BETWEEN " & Me.DateFrom & " AND " & Me.DateTo
DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria

End Sub

Close and save the form with an appropriate name. Set it so that this form now opens instead of the report when the user wants to view/print the report.

As before add a textbox to your report as described in previous post.
Sep 5 '06 #9

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

Similar topics

6
by: BlackFireNova | last post by:
Using Access 2002 I am writing a report which draws data from several different tables. I can't link all the tables in a query, as some can not be related without truncating the data. I plan...
1
by: Todd D. Levy | last post by:
Normally, I have a date field in the query that a report is based on that requests the user to select a start date and an end date. I now have a situation where there are 2 date fields that the...
5
by: Michelle | last post by:
Hi all I have a report which displays staff absences. An absence record has a start and end date and the type of absence, ie sickness, annual leave. I have created a form which allows the...
3
by: manning_news | last post by:
Using A2K. I've been asked to modify a report currently requiring only one date parameter to now accept a date range. The main report has 2 subreports and is not bound to a table or query. The...
2
by: Sara | last post by:
I have followed instructions on the http://allenbrowne.com/tips.html for limiting a report to a date range. At the bottom there is a note that says You will end up using this form for all sorts...
0
by: Rick | last post by:
I've seen postings before showing users how to set the range but I'm still not able to get it working locally. I have a report with one range and nothing else, it's a date range, I need to set...
3
by: Deano | last post by:
The short version; In short, given one date range (start and end dates) how can I find the period that overlaps with another date range? The long version; I have knocked up a little application...
12
smithj14
by: smithj14 | last post by:
I have a form to enter start and end dates then select a worker name to filter a report. This all works fine and when the report is open in preview mode it shows the date range in the txtboxes on the...
3
tuxalot
by: tuxalot | last post by:
I have a listbox showing reports, and when a report is selected, criteria (dates, employee name, etc.) necessary to print that report become visible. For a few reports, I would like to have the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.