Hi Yuri,
thanks for the help.
Unfortunately I don't seem tobe able to get away from the Error: 1429: OLE IDispatch exception code 0 from Microsoft Word: String is longer than 255 characters.
I tried splitting the string up like this:
.OpenDataSource(m._QueriesText,0, ;
.F., .F., .T., .F., "", "", .F., "", "", ;
[Provider=Microsoft.Jet.OLEDB.4.0;];
+ [Password="""";User ID=Admin;Data Source=] + m._Dir_Net + [;];
+ [Mode=Read;Extended Properties="""";];
+ [Jet OLEDB:System database="""";];
+ [Jet OLEDB:Registry Path="""";];
+ [Jet OLEDB:Database Password="""";];
+ [Jet OLEDB:Engine Type=18],;
"SELECT * FROM '" + JUSTFNAME(m._QueriesText) + "'", "")
but still get the error. Have you got any suggestions?
Thanks again,
>Try to follow the syntax for OpenDataSource method. See VBA help for your MS WOrd version:
>
>In MS WORD 2002 it is:
>expression.OpenDataSource(Name, Format, ConfirmConversions, ReadOnly, LinkToSource, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Connection, SQLStatement, SQLStatement1, OpenExclusive)
>
>If following the above, the statement looks like:
>
> .OpenDataSource("C:\Development\VFP8\SigmaSoft\DMSys 5.0\test.DBF",
> wdOpenFormatAuto,.f.,.f.,.t.,;
> .f., "","",.f.,"","", ;
> [Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\Development\VFP8\SigmaSoft\DMSys 5.0;Mode=Read;Extended Properties="""";]+;
> [Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engine Type=18],;
> "SELECT * FROM `test`","")
>
>
>The particular option may have the string that is too long; then separate pieces similar as above for connection.
>
>
>
>>Hi,
>>
>>I need some help translating some VBA to open a Foxplus type datasource for a mail merge in WOrd. Here's the code from the macro I recorded:
>>
>> ActiveDocument.MailMerge.OpenDataSource Name:= _
>> "C:\Development\VFP8\SigmaSoft\DMSys 5.0\test.DBF", ConfirmConversions:= _
>> False, ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
>> PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
>> WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
>> Connection:= _
>> "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\Development\VFP8\SigmaSoft\DMSys 5.0;Mode=Read;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engine Type=18" _
>> , SQLStatement:="SELECT * FROM `test`", SQLStatement1:="", SubType:= _
>> wdMergeSubTypeAccess
>>
>>Can anyone help me sort this out?
>>
>>Thanks,
>>
>>Frank.