C
che
Hi there,
I am trying to programmatically create an .ODC in my application and assign
it to a template for mail merge.
So far I have recorded a macro setting the .ODC up and cut and paste the
macro code into my application:
myDoc.MailMerge.OpenDataSource(Name:= _
"C:\Documents and Settings\cb\My Documents\My Data
Sources\RRS-MSSQL-DEV SUPPORT ctrl_users.odc" _
, ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=WdOpenFormat.wdOpenFormatAuto, Connection:= _
"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=True;Initial Catalog=SUPPORT;Data Source=RCS-MSSQL-DEV;Use Procedure for
Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=CLYD42J;Use
Encryption for Data=False;Tag with column" _
, SQLStatement:="SELECT * FROM ""ctrl_users""", SQLStatement1:="", _
SubType:=WdMergeSubType.wdMergeSubTypeOther)
This isn't working like it does in Word itself. I only have 2 database
fields after the datasource is opened - M_1 and M! When I complete this macro
in Word itself, I have access to all the correct fields.
Any help would be appreciated. Thanks in advance!
I am trying to programmatically create an .ODC in my application and assign
it to a template for mail merge.
So far I have recorded a macro setting the .ODC up and cut and paste the
macro code into my application:
myDoc.MailMerge.OpenDataSource(Name:= _
"C:\Documents and Settings\cb\My Documents\My Data
Sources\RRS-MSSQL-DEV SUPPORT ctrl_users.odc" _
, ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=WdOpenFormat.wdOpenFormatAuto, Connection:= _
"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=True;Initial Catalog=SUPPORT;Data Source=RCS-MSSQL-DEV;Use Procedure for
Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=CLYD42J;Use
Encryption for Data=False;Tag with column" _
, SQLStatement:="SELECT * FROM ""ctrl_users""", SQLStatement1:="", _
SubType:=WdMergeSubType.wdMergeSubTypeOther)
This isn't working like it does in Word itself. I only have 2 database
fields after the datasource is opened - M_1 and M! When I complete this macro
in Word itself, I have access to all the correct fields.
Any help would be appreciated. Thanks in advance!