Viewing certain dates in Table (1 Viewer)

mateogp

Registered User.
Local time
Yesterday, 21:23
Joined
Aug 11, 2004
Messages
43
Hello,

What I want to do is create a query that will show you ONLY records between the dates that you selected.

I want to create the query based on what the user enters on the form.
(Enter Begin Date: Enter End Date:)

I also want to create command buttons labeled "Today,This Week, This Month, This Year) to view records as the buttons are labled.

Does anyone have any suggestions of the best way to go about this is? Maybe a sample database? If I just knew the term im looking for I could look it up and figure out how to do it. I always try to search through the forum before posting a question someone else has already asked, no luck with that one.


I would appreciate any help you guys can offer!!!


Thanks in Advance!
Mateo
 

RichO

Registered Yoozer
Local time
Yesterday, 21:23
Joined
Jan 14, 2004
Messages
1,036
It all comes down to using the proper fields/expressions and criteria in your query.

If you want the query to display only records between the 2 values entered on the form, select your date field and use the criteria:

Between [Forms]![MyForm]![txtBeginDate] And [Forms]![MyForm]![txtEndDate]

For records matching the current week, you would need to use an expression as your field:

WeekOfDate: DatePart("ww", MyDateField)

...and the criteria would be DatePart("ww", Date())

For current month:

Month(MyDateField) and criteria Month(Date())

And year works just like month, by simply substituting the word "year"

Do some research on Access' date functions and you'll find there is alot you can do with them.
 

Users who are viewing this thread

Top Bottom