Thanks for your help. I'm using Word 2000 but I want the
document to run on Word 97.
The SQL statement is as follows;
SELECT
bookings.ClientID,bookings.Date,bookings.StartTime,
bookings.Description, bookings.Notes, Clients.FirstName,
Clients.LastName, Clients.Address1, Clients.City,
Clients.State, Clients.Postal, Clients.HomePhone,
Clients.WorkPhone
FROM "C:\AppData"\bookings bookings, "C:\AppData"\Clients
Clients
WHERE Clients.ClientID = bookings.ClientID AND
((bookings.Description='NP') AND (bookings.Date Between
{d '2004-01-01'} And {d '2010-12-31'}))
ORDER BY bookings.Date
I'm trying to restrict the mail merge records between 2
dates which are obtained by the user via a dialogue box
with 2 textboxs. Thanks for any suggestions you have
Peter Wilde
>-----Original Message-----
>What is the query you start with, and what are you assigning to
[quoted text clipped - 26 lines]
>
>.
Peter Jamieson - 11 May 2004 00:35 GMT
OK, I don't have the same database software you have, but using an Access
.mdb with suitable tables and fields and similar query text I do not have
problems here with Word 97/Access 97 and ODBC (on Win98, as it happens).
So the thing works in principle, and in particular
a. the query is not too long (510 characters is the limit)
b. the ODBC escapes for the dates - { d '2004-01-01' } etc. work correctly.
So the only things I can thing of are:
a. is the query syntax correct for your data source - in particular, the
quoting is unusual in:
FROM "C:\AppData"\bookings bookings, "C:\AppData"\Clients Clients
(
I would expect something more like
FROM "C:\AppData\bookings" bookings, "C:\AppData\Clients" Clients
and possibly to have to include file extensions in the table names. I didn't
replicate this part in my query since I only needed
FROM bookings bookings, Clients Clients
You might also have to use single quotes.
)
b. does your ODBC driver support the ODBC escape syntax for dates? If you
remove the date constraint, does the modified querystring succeed or fail?

Signature
Peter Jamieson
> Thanks for your help. I'm using Word 2000 but I want the
> document to run on Word 97.
[quoted text clipped - 58 lines]
> >
> >.