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!

OLE add_arg

Status
Not open for further replies.

somarina

Programmer
Aug 14, 2002
6
0
0
SK
Hi,

I have problem with passing parameters to method
OpenDataSource. I need set connection string and
SqlStatement.
OpenDataSource(Name, Format, ConfirmConversions, ReadOnly, LinkToSource, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Connection, SQLStatement, SQLStatement1)
The VBA equivalent:
WordBasic.MailMergeOpenDataSource Name:="", LinkToSource:=1, _
Connection:=conect$, SQLStatement:=select1$, _
SQLStatement1:=select2$
I tried it with data in file and it works fine, but it`s only with first parameter "Name" - name of data file.
I tried to write something like
lst := ole2.create_arglist;
ole2.add_arg (lst, 'E:\ODT\CLIENT\odt_export_dat1.txt'); -- Name data file
ole2.add_arg (lst, '' ); --Format
-- ole2.add_arg (lst, '' ); --ConfirmConversions
-- ole2.add_arg (lst, ''); --ReadOnly
-- ole2.add_arg (lst, ''); --LinkToSource
-- ole2.add_arg (lst, ''); --AddToRecentFiles
-- ole2.add_arg (lst, ''); --PasswordDocument
-- ole2.add_arg (lst, ''); --PasswordTemplate
-- ole2.add_arg (lst, ''); --Revert
-- ole2.add_arg (lst, ''); --WritePasswordDocument
-- ole2.add_arg (lst, ''); --WritePasswordTemplate
-- ole2.add_arg (lst, sConnectString); --Connection
-- ole2.add_arg (lst, sSelect); --SQLStatement
-- ole2.add_arg (lst, '1'); --SQLStatement1
ole2.invoke(obj_merge, 'OpenDataSource',lst);
ole2.destroy_arglist(lst);

but it doesn`t work. It works with two parameters but if i add third it clears all settings.
What is wrong ? How to set specific parameters.
Where I find description of HRESULTs codes ?
In this case error code is 2148144860.

Any thoughts welcome.

Thanx.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top