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
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