Group:  Microsoft Word ยป microsoft.public.word.mailmerge.fields
Thread: Filter Merge Data by Date Range

Geek News

Filter Merge Data by Date Range
Stuart Troy 6/7/2007 2:31:06 PM
Hi Guys,

I'm merging with an SQL table, which includes a date column.
And I need to merge the records for a specific day only.

The date column is formatted as '2007-12-31' (yyyy-mm-dd) and includes a
time stamp 00:00:00.

But when I use "Filter & Sort" in Word, I cannot get it to filter by the
date at all. No matter what varations of operators & values I try, it won't
filter the results.

I know I could create a View in SQL, but I'd like to find a Word based
solution.

Thanks for your input.
Kind regards
Stuart
Sydney, AUSTRALIA
Re: Filter Merge Data by Date Range
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 6/7/2007 4:03:45 PM
The trouble is that Word tries to generate the wrong syntax SQL code, then
gets confused (as far as I know).

Also AFIK, the only approach to a solution other than using a view is to
issue your own SQL in Word VBA, e.g.

ActiveDocument.MailMerge.OpenDataSource _
Name:="the pathname of the .odc file you are using to connect", _
SQLStatement:="SELECT * FROM [mytable] WHERE [mydate] = '2007-12-31'

Peter Jamieson

"Stuart Troy" <StuartTroy[ at ]discussions.microsoft.com> wrote in message
news:57C9E488-03FF-4969-BABE-846864F770BD[ at ]microsoft.com...
[Quoted Text]
> Hi Guys,
>
> I'm merging with an SQL table, which includes a date column.
> And I need to merge the records for a specific day only.
>
> The date column is formatted as '2007-12-31' (yyyy-mm-dd) and includes a
> time stamp 00:00:00.
>
> But when I use "Filter & Sort" in Word, I cannot get it to filter by the
> date at all. No matter what varations of operators & values I try, it
> won't
> filter the results.
>
> I know I could create a View in SQL, but I'd like to find a Word based
> solution.
>
> Thanks for your input.
> Kind regards
> Stuart
> Sydney, AUSTRALIA

Re: Filter Merge Data by Date Range
"Stuart Troy" <stutroy[ at ]hotmail.com> 6/16/2007 11:50:16 AM
Thanks Peter,
I used a similiar solution, using the DATABASE field with an SQL query.
It works nicely.
Thanks again.
Stuart
Sydney, AUSTRALIA


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net