473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem querying SQL Server View as mail merge source

Hi,

I'm using the following code to perform a mail merge from an Access
project:

With docMailMergeSource.MailMerge
..MainDocumentType = wdFormLetters
..OpenDataSource Name:=<datasource path>, _
Format:=wdOpenFormatAuto, ReadOnly:=True, LinkToSource:=False, _
ConfirmConversions:=False, _

SQLStatement:="SELECT * FROM dbo.WelcomeLetterMailMerge_V WHERE
AgreementDate >= 'Sep 1, 2001'", _

Connection:="DRIVER=SQLServer;SERVER=SOMESVR;UID=d eveloper;PWD=;APP=Microsoft
Data Access Components"

..Destination = wdSendToNewDocument
..Execute
..MainDocumentType = wdNotAMergeDocument
End With
The problem I'm having is with the SQLStatement. As is, I get a "word
is unable to open datasource" error. If I change it to "SELECT * FROM
dbo.WelcomeLetterMailMerge_V WHERE 1=1", everything works fine, but I
don't have any date constraint. Am I representing the date in an
incorrect format? If I paste the query into Query Analyzer, it runs
just fine. I've tried using # marks, and double quotes to surround
the date, but haven't had any luck.

Any Suggestions?

Thanks,

Todd
Nov 13 '05 #1
1 2718
to*****@hotmail.com (Todd H) wrote in message news:<68*************************@posting.google.c om>...
Hi,

I'm using the following code to perform a mail merge from an Access
project:

With docMailMergeSource.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource Name:=<datasource path>, _
Format:=wdOpenFormatAuto, ReadOnly:=True, LinkToSource:=False, _
ConfirmConversions:=False, _

SQLStatement:="SELECT * FROM dbo.WelcomeLetterMailMerge_V WHERE
AgreementDate >= 'Sep 1, 2001'", _


Try #9/1/01#
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steve M | last post by:
I'm trying to do invoke the mail merge functionality of MS Word from a Python script. The situation is that I have a template Word document, and a record that I've generated in Python, and I want...
20
by: Neil | last post by:
I have an Access 2000 MDB file with a SQL 7 back end. I have a main table with 50,000 records; and I have a selections table with 50,000 records for each machine that uses the database (about...
2
by: William Wisnieski | last post by:
Hi Everyone, Access 2000 I have some code behind a button that performs a word merge with a query data source. The merge works fine. But what I'd like to do somehow is after the merge is...
8
by: Squirrel | last post by:
Hi everyone, I've created a mail merge Word doc. (using Office XP) , the data source is an Access query. Functionality I'm attempting to set up is: User sets a boolean field to true for...
3
by: Andy Davis | last post by:
I have set up a mail merge document in Word 2003 which gets its data from my Access 2000 database. I want to set up a button on a form that: 1. runs the query to provide the dat for the merge...
4
by: pmhaupt2 | last post by:
I developed an Access 2003 program that will allow the user to produce a group of Word letters that merge with data records from an Access database. I created a mail merge Word document and...
0
by: mbbostwick | last post by:
I have a problem with a mail merge procedure I used to use with Access '97. We recently converted to Office XP (2002) and I now have an issue I am unfamilliar with and have been unable to...
8
by: Ron B | last post by:
Help!!! What am I doing wrong? I am working with Office 2003 and am trying to create a command button on an Access form that will create a mail merge in Word from an Access table. I want to...
0
by: ho.horace | last post by:
Dear All, I am using SQL 2005 as pub and SQL EXPRESS as sub with Merge replication. Got the following error message The schema script 'CD_InTransit_v_153.sch' could not be propagated to the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.