Dates into months

Neil_Pattison

Registered User.
Local time
Today, 06:49
Joined
Aug 24, 2005
Messages
73
The table I want to run the query on has a date in the format of dd/mm/yyyy. I want to be able to run a query so that the user can type in a month and all records with dates in that month will be shown.

I have done this before many years ago but now have a mental block and cant figure it out.

Any help with this would be greatly appreciated
 
The DateSerial() function should help you here.
 
Hello Neil!

Look at "DemoQryMonthA2000.mdb"
Run Query1. there are 1, 2, 3 and 4 month in the table.
 

Attachments

Hi -

Sample query. When prompted, type mmyyyy, e.g. 092007, 102007, etc.. (I'm assuming you want to specify by both month and year).
Code:
PARAMETERS entermoyr Text;
SELECT
    tblDevProcess.startDate
  , tblDevProcess.Item
  , tblDevProcess.Remarks
FROM
   tblDevProcess
WHERE
   (((tblDevProcess.startDate) Between DateSerial(Mid([entermoyr],3),Left([entermoyr],2),1) 
AND
   DateSerial(Mid([entermoyr],3),Left([entermoyr],2)+1,0)));

This will return all records within the specified month and year. Change table and field names as necessary.

HTH - Bob
 

Users who are viewing this thread

Back
Top Bottom