473,842 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

restricting report by range of date

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 user to specify criteria for
viewing the report. The one I am having problems with is the date. I
allow the user to set a date range, so for example, the user selects
01/03/04 to 08/03/04 and I want to be able to show all absences that
fall within that date so in effect the report gives me a complete
picture of who is not available during that week.

so for example if an employee starts leave on 29/02/04 and ends on
2/03/04 i want this to show on the report

would be grateful for any help.

thanks
michelle
Nov 12 '05 #1
5 4504
In the query feeding the report, set the two controls on the form as the
criteria for the date range.

Example:
Between Forms!Form1!txt DateFrom And Forms!Form1!txt DateTo

I noticed that you are not using the US date format. I don't do
internationaliz ation, but from what I've read there are times that you have
to use the US date format to get things such as this to work. If that is the
case, change the above to

Between Format(Forms!Fo rm1!txtDateFrom , "mm/dd/yyyy") And
Format(Forms!Fo rm1!txtDateTo, "mm/dd/yyyy")

The format command changes the date to a string so you may need to also
concatenate in # signs as a date delimiter.

Between "#" & Format(Forms!Fo rm1!txtDateFrom , "mm/dd/yyyy") & "#" And "#" &
Format(Forms!Fo rm1!txtDateTo, "mm/dd/yyyy") & "#"

--
Wayne Morgan
Microsoft Access MVP
"Michelle" <mi************ *@poferries.com > wrote in message
news:72******** *************** ***@posting.goo gle.com...
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 user to specify criteria for
viewing the report. The one I am having problems with is the date. I
allow the user to set a date range, so for example, the user selects
01/03/04 to 08/03/04 and I want to be able to show all absences that
fall within that date so in effect the report gives me a complete
picture of who is not available during that week.

so for example if an employee starts leave on 29/02/04 and ends on
2/03/04 i want this to show on the report

would be grateful for any help.

thanks
michelle

Nov 12 '05 #2
mi************* @poferries.com (Michelle) wrote in
news:72******** *************** ***@posting.goo gle.com:
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 user to specify criteria for
viewing the report. The one I am having problems with is the date. I
allow the user to set a date range, so for example, the user selects
01/03/04 to 08/03/04 and I want to be able to show all absences that
fall within that date so in effect the report gives me a complete
picture of who is not available during that week.

so for example if an employee starts leave on 29/02/04 and ends on
2/03/04 i want this to show on the report


air code

condition

WHERE fldBeginDateTim e <
Format(YourForm .StopRange.Valu e + 1, "\#mm\/dd\/yyyy\#")
AND fldEndDateTime >=
Format(YourForm .StartRange.Val ue, "\#mm\/dd\/yyyy\#")

"Between" can lead to grief with dates when someone enters a time value
into one of the dates.

Yes, I did mean (begin < stop+1) and (end >=start).

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #3
Thanks Wayne

However, i'm not totally sure that this will work. This will make sure
that anything with a start or end date between the two dates mentioned
on my form is captured. However, what about for an absence that starts
before the dates entered or ends after the dates entered. How would i
capture these.

cheers
michelle

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #4

Thanks Lyle

that worked a treat!!!!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #5
In the query for the report, put this expression in the criteria of the
LeaveDate field:

Between Forms!NameOfFor mToEnterDates!S tartDate And
Forms!NameOfFor mToEnterDates!E ndDate

Open the form to enter dates in the Open event of the report:
DoCmd.OpenForm "NameOfFormToEn terDates"

Put an OK button on the form to enter dates and put this code in the Click
event:
Me.Visible = False

Close the form to enter dates in the Close event of the report:
DoCmd.Close acForm, "NameOfFormToEn terDates"
DoCmd.Close 'this is for the report
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com

"Michelle" <mi************ *@poferries.com > wrote in message
news:72******** *************** ***@posting.goo gle.com...
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 user to specify criteria for
viewing the report. The one I am having problems with is the date. I
allow the user to set a date range, so for example, the user selects
01/03/04 to 08/03/04 and I want to be able to show all absences that
fall within that date so in effect the report gives me a complete
picture of who is not available during that week.

so for example if an employee starts leave on 29/02/04 and ends on
2/03/04 i want this to show on the report

would be grateful for any help.

thanks
michelle

Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
17690
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
1
1679
by: Mike Cooper | last post by:
Hi everyone, This is a tough one. I have a database full of solicitations, identifying a customer and recording initial call, first followup, second followup, etc. My boss want to be able to generate a report showing a list of customer who were call between two different dates that he types into a form. That, I have done. My boss types in his two dates, the SQL statement searches through the follow-up call fields for a date
3
7470
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 report prints dental and hygenist appointments for the date (one subreport for each). The user wants to enter a date range and have one page for each date in the date range. I'm wondering how to modify the report. The only way I see is to create...
0
1763
by: Stinky Pete | last post by:
Hi, The db I'm trying to update has a report form from which all other statistical forms and reports are selected/printed by dept, type, cost, number etc. The report form uses a date filter to generate the necessary data and you can also addtionally filter by by individual department/s, supplier/s if you so wish which is great However, I'm trying to develop an individual statistical form that for one subform uses the date filter as...
5
4623
by: sara | last post by:
I have reports that run from a form where the user can choose a date range, or they run automatically for a week in the "Weekly Reports" option. I created 2 queries and 2 reports - one query uses the WeekEndDate to filter, and its associated report heading says "For the week Ending " & forms!frmPrintReports.getWeekEndDate. The other query selects the date range using "Between" and the 2 dates on the form. Its associated report header...
1
2288
Altius
by: Altius | last post by:
Access Version: 2003 OS: XP Pro Sorry if this is a bit long winded. First a little info about the database. This database is used to keep track of checkout information from our production department. It has three main tables that store information, the first one, that I have named "Checkout", stores the information I am querying for the two reports. It has six different fields - OrderNumber, Date, CheckedBy, BuiltBy, SerialNumber, and...
5
2831
by: ladybug via AccessMonster.com | last post by:
I am trying to create a report using multiple tables. The first table has Employee info in it (name and id's). the next three tables have employee info for training, test, scores, etc. I am having trouble in how to set up a report to capture all the of the tables for one specific employee and for a date range. If I create the report based on the Employee info in table 1 and then create
19
3941
by: ali3n8 | last post by:
Hello I have attempted to create a date range report from a query called qrycustomerinformation. The field that contains the value of my date is called Followup. When i run a report on this it is fine. But I have decided I would like to pull this report for a specific date range. Ive attempted to use the method on allen brownes page http://allenbrowne.com/casu-08.html. I would like to also mention the followup field also uses this code to...
12
3279
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 report header, but when I print the report the value for these txtboxes are #Name? Here is the code Date Range Form: Private Sub cmdViewErrorReport_Click() Dim stDocName As String Dim stDocName2 As String Dim stWhere As String...
0
9709
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10936
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10609
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10303
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7025
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5695
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4085
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3140
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.