I have a hire date field that is mm/dd/yyyy, how to I create a prompt in this field to get all the people hired in any month/year combination?
I have a hire date field that is mm/dd/yyyy, how to I create a prompt in this field to get all the people hired in any month/year combination?
It wouldn't be the most efficient, but:
WHERE Month(FieldName) = Forms!... AND Year(FieldName) = Forms!...
Personally I'd extrapolate the start/end dates from the input and have the query use those:
WHERE FieldName Between Forms!... And Forms!...
If you want prompts for the year and date, use a prompt inside of brackets e.g. [TheMonth] instead of 10Code:SELECT tbl1.[Field1], tbl1.[Field2], Year([SomeDateField]) AS Exp1, Month([SomeDateField]) AS Expr2 FROM tbl1 WHERE (((Year([SomeDateField]))=2020) AND ((Month([SomeDateField]))=10))
Obviously you have to use your own table and field names. Untested, but should work.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
If you only have a small number of records, then using the Month and Year suggestions made by both pbaldy and Micron should work OK
However, that approach won't allow Access to make use of any indexes on the date fields so will be very slow for a large dataset.
I would recommend the second approach Paul suggested as it will make use of date indexes and be much faster especially for large datasets.
To use this, lets take an example. Say the user selects October and 2019, then filter for all dates between the first and last days of that month : 01/10/2019 & 31/10/2019.
This can be easily done using code
For more info, see my article on optimising queries http://www.mendipdatasystems.co.uk/s...s-8/4594556613
The query has two different date sets a user might want to query, fiscal year/period or month/year to see different data. Would a form allow for one or the other to be used?
Yes. Have two different date selectors available.
My Incident Analysis example app includes multiple different ways of selecting date ranges:
If interested in knowing more, its available at http://www.mendipdatasystems.co.uk/m...ter/4594454290
isladogs, this link goes to an advertisement, are you selling your solution/app?
Hi.
Sorry something went wrong with my webhost names.co.uk and the links went astray earlier. The page you may have seen was for the webhost.
It should be OK again now. I'd be grateful if you could check & let me know.
The example app in the link is completely free
I did try again and it still goes to the webhost page
Hmm, its working for me...
Let me try the link again...http://www.mendipdatasystems.co.uk/m...ter/4594454290.
If it still fails for you, click my website link below or go to www.mendipdatasystems.co.uk then Downloads...Example Databases...Multiple Group and Filter
all links go to medipdatasystems.co.uk Is there any chance you could zip and attach it here? Thanks
Hmm....my website is www.mendipdatasystems.co.uk and the page you want is http://www.mendipdatasystems.co.uk/m...ter/4594454290. It should look like this:
If you do see that, you want the Incident Analysis example further down the page.
However, if you still get this...
then I need to contact my webhost & will upload the file here as requested
P.S. Apologies for the hassle ...and the huge images
yes please upload as nothing above DON'T LET THIS SPACE GO TO WASTE appears from any of the links provided. Thanks!
Thanks. I've just contacted my webhost but its likely to be an issue for a few days at least due to the New Year.
The file is now attached. Hope it was worth the wait....
FWIW: The link below is to an archive of that webpage that I saved yesterday ... courtesy of the Internet Archive:
Multiple Group & Filter - Mendip Data Systems (archive.org)
Hopefully that does work for you
Archive works for me?
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba