473,406 Members | 2,208 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,406 software developers and data experts.

Date Range but for Current Year

I have a form that allows the user to choose and open a report from a
drop down box based on the semester they choose from an option box.
Option 1-3 are Spring, Summer and Fall and each semester has their
specific dates. This is what I currently have on the preview button if
option one is selected and continues for the rest of the options with
the appropriate dates.

If (FraWIASemesters = 1) Then
' Preview all records.
DoCmd.OpenReport strReportName, acViewPreview, "", "[Date]
Between #12/16/2004# And #5/15/2005#"
End If

Summer: Between #5/16/2005# And #8/15/2005#"

Fall: Between #8/16/2005# And #12/15/2005#"

How can I set a date range but for current year so that I don't have to
go in and change it on a regular basis?

Sep 14 '06 #1
5 2575
use DateSerial, Date()

something like BETWEEN DateSerial(Year(Date()),5,16) And
DateSerial(Year(Date()),8,15)

and then you have to go out and have a stiff drink or two.

Sep 14 '06 #2
"mchlle" <mc****@austin.rr.comwrote in
news:11*********************@i3g2000cwc.googlegrou ps.com:
I have a form that allows the user to choose and open a report
from a drop down box based on the semester they choose from an
option box. Option 1-3 are Spring, Summer and Fall and each
semester has their specific dates. This is what I currently
have on the preview button if option one is selected and
continues for the rest of the options with the appropriate
dates.

If (FraWIASemesters = 1) Then
' Preview all records.
DoCmd.OpenReport strReportName, acViewPreview, "",
"[Date]
Between #12/16/2004# And #5/15/2005#"
End If

Summer: Between #5/16/2005# And #8/15/2005#"

Fall: Between #8/16/2005# And #12/15/2005#"

How can I set a date range but for current year so that I
don't have to go in and change it on a regular basis?

Dim dtFrom as date, dtTo as date
Dim stWhereClause as string

select case FraWIASemesters
case 1
dtfrom = "12/16/" & year(now())-2
dtTo = "5/15/" & year(now()-1
case 2
dtfrom = "5/16/" & year(now())-1
dtTo = "8/15/" & year(now()-1
case else
dtfrom = "5/16/1492"
dtTo = "8/15/2525"
end select

stwhereclause = "Between #" & dtfrom & "# AND #" & dtTo & "#"

DoCmd.OpenReport strReportName, acViewPreview..stWhereClause

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Sep 14 '06 #3

pi********@hotmail.com wrote:
use DateSerial, Date()

something like BETWEEN DateSerial(Year(Date()),5,16) And
DateSerial(Year(Date()),8,15)

and then you have to go out and have a stiff drink or two.
Thanks but this brings up everyone from my query.

I need this to look at my "Date" field to determine who has had
assistance during this semester based on the "date" the record was
entered.
Hope this makes sense.

Thanks again.

Sep 14 '06 #4
Hi Bob

Thanks, I copied and pasted the code above but kept getting end of
statement errors.
Also, what are these years:
dtfrom = "5/16/1492"
dtTo = "8/15/2525"
Sep 14 '06 #5
"mchlle" <mc****@austin.rr.comwrote in
news:11**********************@e3g2000cwe.googlegro ups.com:
Hi Bob

Thanks, I copied and pasted the code above but kept getting
end of statement errors.
Also, what are these years:
>dtfrom = "5/16/1492"
dtTo = "8/15/2525"

1492 Columbus discovers America
2525 Title of Zager and Evans song.

I use them when I want to return all records because they are
before any reasonable date in the past and far enough into the
future to capture everything. I use them instead of having a
separate OpenReport statement with no filter
as to the error messages, I missed a ) in typing the dtto
year(now()-1 should be year(now())-1.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Sep 14 '06 #6

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

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
8
by: peashoe | last post by:
I have an asp page that uses a calendar.js (pop-up) file to add an exact date format in the text field (txtDDate). My problem is I need some javascript that sets an alert that does not allow them...
5
by: Dennis M. Marks | last post by:
After reading section 15.9.1.1 the ECMAScript Language Specifications I see that the date range for the Date function is +/- 100,000,000 days from 01 Jan 1970. This is called an extrapolated...
2
by: Ian | last post by:
I would like to have some validation on a date field. The date format is dd/mm which is used for our financial year end. I suppose I need also consider leap years. Please can you shed some light on...
16
by: KL | last post by:
I am working on a problem and desperately need help! I need to prompt a user for the numerical month of birth, day of birth and year of birth and store it in varialbes and the use the variables...
26
by: jshanman | last post by:
I am writing a timeline that uses Google Maps. I have a function that converts a date time to latitude coords. This function is used to draw the markers on the timeline. I need a reverse function...
1
by: Hetal | last post by:
I am working on Visual Basic 2003 and i had a question about date functions. Is there a way to get the date range for a week based on the combination of 1) Week of the year and 2) Year? I mean, is...
34
by: -Lost | last post by:
I'm REALLY liking this so far. And for those who welcome something a little less cryptic than what the resident date guru offers, here's a chance to try something fairly elegant and definitely...
2
by: Greg (codepug | last post by:
I’m working on setting a date range for filtering that is created OnClick of a button. I want to use the current date as the EndDate and the StartDate I want to be the 01/01/SameYear. Example:...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.