Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I filter a record with more than one date to show me ONLY the closest
date to today.

Thank you.
 
How can I filter a record with more than one date to show me ONLY the closest
date to today.

Thank you.

Put a calculated field in the Query by typing

DaysToService: Abs(DateDiff("d", [ServiceDate], Date()))

in a vacant Field cell. (You say "nearest" so I'm using the absolute
value function Abs(), so it will find the nearest past or future
date).

Sort by this field, descending, and set the Top Values property of the
query to 1 to show only the one date. If there are several records all
equally close you'll see all of them.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top