Query: Date

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

Guest

How can I get a record with a lots of services date to show me ONLY the
closest date to today.

Thank you.
 
This is just off the top of my head (without any testing)

Select <fields>, DateDiff("d", Now(), Me.[ServiceDate]) as DaysDiff
From <table>
Where DateDiff("d", Now(), Me.[ServiceDate]) <= [ ..... provide an
acceptable # days ..... ]

The DateDiff() will get the days differences. After that, the next thing to
determine is the acceptable number of days that you would consider "close".
In this case, you can either hard code a value or you can make it a
parameter.

Hopefully this will stimulate some thoughts.

HTH

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 

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

Similar Threads


Back
Top