Query: Date

N

NL

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

Thank you.
 
R

RobFMS

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

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
Top