A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Parameter query for parts of date



 
 
Thread Tools Display Modes
  #1  
Old May 17th, 2004, 06:26 PM
Rose
external usenet poster
 
Posts: n/a
Default Parameter query for parts of date

My date field is the traditional mm/d/yy format. I need to
create a parameter query that asks for the month and then
the year. I'm sure DatePart comes into this somewhere, but
wild guesses at the right way to word my criteria have failed.
  #2  
Old May 17th, 2004, 11:41 PM
Douglas J. Steele
external usenet poster
 
Posts: n/a
Default Parameter query for parts of date

Create a couple of calculated fields in your query, one to represent the
month and one for the year. You can either use DatePart, or the Month and
Year functions. Place your parameters relative to those computed fields.

The SQL would look something like:

SELECT Field1, Field2
FROM MyTable
WHERE Month(MyDate) = [Enter Month Number]
AND Year(MyDate) = [Enter Year]



--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Rose" wrote in message
...
My date field is the traditional mm/d/yy format. I need to
create a parameter query that asks for the month and then
the year. I'm sure DatePart comes into this somewhere, but
wild guesses at the right way to word my criteria have failed.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.