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

Help needed with a Dates Access Query

Can somone help me contruct a simple query

Basically I want my query to extract records where the MOT_Due_Date is
between the 1st Day of the current month and the date 6 weeks from the
1st day of the current month.

My MOT_Due_Day field is in the format "dd<space>mmm" ie 08 Jun and is
a text field, not a date field

i.e.
Select * <- I actually name all the fields but * is easier to type
FROM Vehicle
WHERE MOT_Due_Date & " " & format(now(), "yyyy")
BETWEEN {this is the bit i cant figure out}
an example would be Where MOT_Due_Date BETWEEN 01/01/04 AND 12/02/04

Is the 1st Day of the current month : "01 " & Format(now(),"mmm yyyy")
??
I dont know how to calculate 6 weeks from the 1st Day of current
month, can someone help me out here?

Thanks in Advance if you can help
Much appreciated

Doug
Nov 12 '05 #1
2 2397
Maybe,

BETWEEN Month(Date()) AND Date() + 42

will do the trick?
Pavel

Douglas wrote:

Can somone help me contruct a simple query

Basically I want my query to extract records where the MOT_Due_Date is
between the 1st Day of the current month and the date 6 weeks from the
1st day of the current month.

My MOT_Due_Day field is in the format "dd<space>mmm" ie 08 Jun and is
a text field, not a date field

i.e.
Select * <- I actually name all the fields but * is easier to type
FROM Vehicle
WHERE MOT_Due_Date & " " & format(now(), "yyyy")
BETWEEN {this is the bit i cant figure out}
an example would be Where MOT_Due_Date BETWEEN 01/01/04 AND 12/02/04

Is the 1st Day of the current month : "01 " & Format(now(),"mmm yyyy")
??
I dont know how to calculate 6 weeks from the 1st Day of current
month, can someone help me out here?

Thanks in Advance if you can help
Much appreciated

Doug

Nov 12 '05 #2
Doug,

how about:

SELECT *
FROM Vehicle
WHERE MOT_Due_Day BETWEEN DateSerial(Year(Date),Month(Date),1) AND
DateAdd("w",DateSerial(Year(Date),Month(Date),1),6 );

Why is your Date Field a text field? Then you'll have to use CDate()
to convert it to a date.
?Cdate("8-Jun")
6/8/2004
Nov 12 '05 #3

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

Similar topics

4
by: Surendra | last post by:
I have a table that has fields GRP_CODE & END_DATE. For a given GRP_CODE and a given month of a year, there may be 1, 2 or 3 END_DATE values. For Example, GRP_CODE END_DATE AA ...
3
by: Raghuraman | last post by:
Hai I have a designed Crystal report .rpt file which has 4 access tables .. After designing the report i put a parameter field which filteres the desired records quite naturally. Every thing...
1
by: John | last post by:
I'm building a report where each row represents one month and its 1 to 5 weeks. A report query groups the source table date into a "month and year" expression. A subreport links to the main report...
0
by: vinaysamineni | last post by:
i have two tables ---Rental----- Column name Data type Comments TransactionNum Long Integer Primary key. VideoCardNum Text(10) Foreign key Customer. StoreNum Text(3) Foreign key Store....
1
by: tulikapuri | last post by:
Hi Friends, I am new to Access DB and i am trying to put a DB for a Foundry Lab, I am willing to generate one single report from multiple tables but i am really confused how should i really do...
3
by: b4babu | last post by:
Hi, I've a table named PC as below: PC(code, model, speed, ram, hd, cd, price) I want to write a query to find the pairs of PC models having similar speeds and RAM. Also, in the result set, the...
5
by: silversubey | last post by:
I have a query that works in Access. It pulls time in a format that is understood by Quickbooks. We are upgrading our access-based program to MSDE. I have tried 3rd party converters and searched...
5
by: Davidsm | last post by:
Hi I am using MS access query my problem is that I have a coloumn called Measure and one called MO.Where data is equal to "ABC" in MO column I need the data "ABC" to overwright the value in the...
7
by: raaman rai | last post by:
Hello everybody, well i have 3 tables created in my access db i.e tblClient, tblProject & tblPayment. The main table is tblClient where Client information is stored with ClientID as the Primary key....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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...

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.