Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / January 2004

Tip: Looking for answers? Try searching our database.

How to enter a Date in Advanced | Filter Records

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Loretta Johnson - 22 Jan 2004 17:23 GMT
I need to filter my data source to include only records
that have been modified since a specific date.  I have a
ModifiedDate field that is defined in SQL Server as a
datetimestamp.  I have tried every way I can think of to
enter the date to get the records filtered.  However, I
always end up with all of the records showing in the Mail
Recipients dialog.

Does anyone know the proper way to enter dates when
filtering?  The dates are displaying in YYYY-MM-DD
HH:MM:SS .... and so on.  

Thank you in advance.
Cindy M  -WordMVP- - 22 Jan 2004 18:59 GMT
Hi Loretta,

I can't recall having ever tested this with SQL Server,
but...

generally, the Query Options dialog box will only work with
dates if they're entered in "good old" U.S. date format:
mm/dd/yyyy

If that doesn't work for you, then the best thing would
probably be to create a macro (VBA) interface to set the
QueryString property for the merge document. for that, you
should be able to use an SQL Select statement that
corresponds to what you'd generally use with SQL Server.

> I need to filter my data source to include only records
> that have been modified since a specific date.  I have a
[quoted text clipped - 7 lines]
> filtering?  The dates are displaying in YYYY-MM-DD
> HH:MM:SS .... and so on.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep
30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:-)
Peter Jamieson - 23 Jan 2004 11:10 GMT
Hi Cindy,

Just as follow-up, I suspect in Word 2003 and probably Word 2002, the macro
approach is the only option if you are connecting via OLEDB. The problem
appears to be that
a. The Query options dialog box will only allow you to enter something that
it thinks looks like a date  - 1994-09-14, 14/09/1994, etc.
b. But whatever you put, Word appears simply to discard it
c. in VBA, none of the date literal formats that SQL should really accept
as valid will work except the "ODBC escape" format. In other words, none of
the following work:

WHERE mydate = 19940914
WHERE mydate = '1994-09-14'
WHERE mydate = '1994-09-14 00:00:00'
WHERE mydate = '14/09/1994'
WHERE mydate = '09/14/1994'

The following do work (at least in the sense that SQL Server recognises the
syntax as valid)

WHERE mydate = { d '1994-09-14' }
WHERE mydate = { ts '1994-09-14 00:00:00' }

d. i.e. in all probability Word does not convert the user specified options
in Query options into a date format that SQL Server (or the OLEDB provider)
recognises, but nor does it allow { d '1994-09-14' } into the Query options
dialog, which would at least give an end user /a/ way of specifying a date.
.
However, in Word 2003 at any rate, things seem to work rather better if you
connect via ODBC. But since that involves all that MS Query stuff it is
somewhat harder (The main trick is to use the Tools menu in the top right of
the Select Data Source dialog box to start MS Query, create a suitable SQL
Server DSN, and take it from there). For an ODBC connection the Mail Merge
Recipients dialog works rather differently. Selecting a specific datetime
value to match from the dropdown at the top of a date column still does
nothing at all. But if you click Advanced, you go to MS Query, where using
the Criteria menu does allow you to specify date comparisons in a way that
works, all other things being equal.

--
Peter Jamieson - Word MVP
Word MVP web site http://word.mvps.org/

> Hi Loretta,
>
[quoted text clipped - 32 lines]
> follow question or reply in the newsgroup and not by e-mail
> :-)
Cindy M  -WordMVP- - 23 Jan 2004 17:47 GMT
Hi Peter,

Glad you're here to do the back up on this one <g>

> Just as follow-up, I suspect in Word 2003 and probably Word 2002, the macro
> approach is the only option if you are connecting via OLEDB. The problem
> appears to be that...

   Cindy
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.