filtering query based date

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access Training and help » Filtering a query based on Date and Time

Filtering a query based on Date and Time

resolvedResolved · Medium Priority · Version 2016

stuart has attended:
Access VBA course

Filtering a query based on Date and Time

hi


i am trying to filter a query based on date and time

in the query there are a number of fields, tow of them are MCUDate and MCUTime

what i want to do is display information from 02:00:00 yesterday and 02:00:00 today


i know i can apply "between Date() and Date()-1" to filter between dates, but how can i apply a time aswell?

RE: filtering a query based on Date and Time

Hi Stuart,

Thank you for the forum question.

I hope you are well.

You will have to concatenate the dates and time in a new field in your query.

DateAndTime:MCUDate & " " & MCUTime

and the field criteria


Between Date()-1 & #02:00:00# And Date() & #02:00:00#

Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: filtering a query based on Date and Time

Hi Stuart,

Thank you for the forum question.

I hope you are well.

You will have to concatenate the dates and time in a new field in your query.

DateAndTime:MCUDate & " " & MCUTime

and the field criteria


Between Date()-1 & #02:00:00# And Date() & #02:00:00#

Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector


 

Access tip:

Prefixed Autonumbering

When using Date Type = Autonumber as a primary key, clients may require autonumbering to be prefixed with a letter.

For example, P001, where P is the prefixed letter

Instructions
Step 1. Create Field Name
Step 2. Set Data Type to Autonumber
Step 3. Within Field Property General tabsheet,
enter Format property as [backslash]P000



View all Access hints and tips


Server loaded in 0.09 secs.