Click to See Complete Forum and Search --> : MS Access Macro
Calvin789
July 30th, 2001, 06:26 PM
Please help. I have a database which has a report. The report has a query which needs to check that a field contains a date in a certain format. The date is written as the year, month, and day put together into one string. For example today would be written as 20010730. How can I use MS Access to get the values that are greater than the current date. Or even more simply how can I get the values of the current month, day, and year. I know this is a lot to ask for but any help would be appreciated.
Thanks in advance,
Calvin
Cakkie
July 31st, 2001, 01:11 AM
Since you always user 8 digits for the date, you might as wel evaluate it as a number, and you then sort it. Let's write it down:
2001/07/01 -> 20010731
is later (bigger) than
2001/06/28 -> 20010628
Also, to get a specific part of a date, you can use the DatePart function.
DatePart("d","2001/06/28") ' would give 28
DatePart("m","2001/06/28") ' would give 6
DatePart("yyyy","2001/06/28") ' would give 2001
Tom Cannaerts
slisse@planetinternet.be
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
Calvin789
July 31st, 2001, 06:22 PM
I can't get the MS Access Query Builder to use any code to query one column to be greater than the current date. Like I could just write in the criteria row:
>20010730 and that works but I wanted to get this to happen automatically. I thought I would be able to figure it out but had no luck.
Thanks again.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.