On Sep 28, 11:22 am, "Sue Mosher [MVP]" <
sue...@turtleflock.com>
wrote:
> Only your first statement is workable. Between is not an available operator,
> and SentOn includes the time element, not just a date, so you're unlikely to
> find an exact match. Seehttp://
www.outlookcode.com/article.aspx?id=30. I
> recommend that you use a separate statement to build the query string so you
> can examine it and, if you continue to have issues with this, post a
> specific example in this thread so we can see how you're formatting the
> dteStart and dteEnd values.
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
>
http://www.outlookcode.com/article.aspx?id=54>
> "McKilty" <
bluesbr...@gmail.com> wrote in message
>
> news:90bca1e3-225e-49ef...@e18g2000vbe.googlegroups.com...
>
> > Hello all,
>
> > I am trying to figure to the proper syntax for using Restrict on the
> > SentOn field. I need to restrict between two dates, but so far
> > nothing is filtering to the exact date range I'm looking for. I have
> > tried:
>
> > Set mItemCollection = mItemCollection.Restrict("[SentOn] > '" &
> > dteStart & "' AND [SentOn] < '" & dteEnd & "'")
> > Set mItemCollection = mItemCollection.Restrict("[SentOn] = '" &
> > dteStart & "'")
> > Set mItemCollection = mItemCollection.Restrict("[SentOn] Between '" &
> > dteStart & "' AND '" & dteEnd & "'")
>
> > Thanks for the help.
Thanks Sue. Your link was very helpful.
Switching to a string rather than a date made it work.