Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Querying an expression within a query 1

Status
Not open for further replies.

tyreanne

MIS
Dec 4, 2000
1
US
I have a query that will ask the user for a certain date and will then find those records. I want the user to be able to put in a date and then have the query list only the records that match that month (mm/dd/yy). I have put in an expression using the DatePart Function so that the month#is returned. I had hoped to then be able to list all records matching the month# of the user specified month. It is not working. Any ideas on how to get Access97 to recognize a date input as mm/yy or how to further query the DatePart Function??

Thanks
 
I don't think I am following this properly. Do you want the query to return the records which match the Month or the month and YEAR of the user input?

To match the Month from the user input, the datepart should do just fine on it's own:

MnthOfRec: Datepart("m", [dateField])

[tab]and in the criteria, also use the datepart of the input parameter:

DatePart("m", [DateParameter])

To also do the year, just repeat the above using "y" (also the field name must change ("YrOfRec"?)).



MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top