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

Perpetual Date Change In a Query

132 100+
I run a report EVERY 2 weeks. I'm using a query as the source of the report. The report is Date driven. Is there a way to implement in the query itself a method to retrieve the Current month? In other words, I generally run the reports from the 1-15th of the month and the 16-31. Instead of manually changing the date parameter in the query from BETWEEN 1/1/2008 - 1/15/2008 TO 1/16/2008 - 1/31/2008, could this be automated?? Also, could the same thing be done for the month and year for that matter?
Feb 21 '08 #1
3 1568
Scott Price
1,384 Expert 1GB
You'll want to investigate the DatePart() function. For example:

Expand|Select|Wrap|Line Numbers
  1. DatePart("m", Date)
will return 2, as the current month of the current date.

Opening the vba code window in Access, (Alt+F11) and typing this into the immediate window (Ctl+G) then pressing F1 will open the topic specific help file which gives you all (or the majority) of the things you can do with this function.

Regards,
Scott
Feb 22 '08 #2
NeoPa
32,556 Expert Mod 16PB
There are also Day(), Month() & Year() functions available which return the numerical equivalents of each component.
Feb 23 '08 #3
FishVal
2,653 Expert 2GB
Also, you may find useful DateSerial() function which combines year, month and day numerical variables back to date variable.

Regards.
Fish
Feb 23 '08 #4

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

Similar topics

7
by: Nicolae Fieraru | last post by:
Hi All, I have a table tblProducts where I have four fields:\ Index, ProductName, EnterDate (as Date/Time - Medium Date), PurchaseDate (Date/Time - Medium Date) The EnterDate is automatically...
1
by: Sunil Korah | last post by:
Hi, My table contains a date field "DateOfVisit" and I have the following query SELECT Patients.PID, Patients.Lastname, Patients.FirstName, Patients.DateOfVisit, Patients.ToReport FROM...
12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
11
by: Dixie | last post by:
How can I programatically, take some Date/Time fields present in a table in the current database and change their type to text? dixie
1
by: igendreau | last post by:
Hopefully this is a simple fix. I'm writing a select query, and I want the user to enter a start date when the query opens, so I have this expression: StartDate: So I open the query, it...
67
by: PC Datasheet | last post by:
Transaction data is given with date ranges: Beginning End 4/1/06 4/4/06 4/7/06 4/11/06 4/14/06 4/17/06 4/18/06 4/21/06 426/06 ...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
2
by: sixdeuce62 | last post by:
Hello, I am trying to create a query that will prompt me to enter the parameter value if beginning date and ending date. I have created everything I need in the query, but I have to manually go...
1
by: flumpuk | last post by:
Hi My job currently requires me to enter data from 300+ forms a month. The system which we used in Excel was slow , and theprevious guy had three workbooks for this job . I have created...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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.