Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail Merge for word 2002: sqlstatement problem

Status
Not open for further replies.

vietnam97

Programmer
Sep 18, 2000
48
0
0
I'm testing the vb code using mail merge with word 2002 for a group of users.
It has been working fine with word 97, however when i ran with word 2002 and tried to call the OpenDataSource method, a Select Table dialog box appeared. Here is the mail merge code that I use:

strSQL = "SELECT [Separate Account].*, [Separate Account New].* FROM [Separate Account] INNER JOIN [Separate Account New] ON [Separate Account New].ContractNumber = [Separate Account].ContractNumber AND "

strSQL1 = "[Separate Account].Index = [Separate Account New].Index WHERE [Separate Account].Index = " & MasterIndex

wd.ActiveDocument.MailMerge.OpenDataSource Name:=CStr(DatabaseName), ReadOnly:=True, SQLStatement:=strSQL, SQLStatement1:=strSQL1

wd.ActiveDocument.MailMerge.Execute Pause:=True

I have a feeling that it has something to do with the multiple-field primary key on my query strings

Can someone help me on this?

Thanks,
Bao


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top