Trying to write a word macro that writes a record to a SQL server.

I

Ian Clark

Have the following macro that inserts records from SQL table -

Selection.Range.InsertDatabase Format:=0, Style:=0, LinkToSource:=False, _
Connection:= _
"Provider=MSDASQL.1;Persist Security Info=True;Extended
Properties=""DSN=Spirit Group;UID=sa;APP=Microsoft Office
2003;WSID=YOUR-HKI1ASH75M;DATABASE=Spirit Group"";Initial Catalog=Spirit
Group" _
, SQLStatement:="SELECT * FROM ""HEATDb""" & "",
PasswordDocument:="", _
PasswordTemplate:="", WritePasswordDocument:="",
WritePasswordTemplate:= _
"", DataSource:= _
"C:\Documents and Settings\ian_clark.SOLUTEC\My Documents\My Data
Sources\Spirit Group HEATDb.odc" _
, From:=-1, To:=-1, IncludeFields:=True

How can I insert into this table the following SQL syntax is – insert into
heatdb (dbname,tablename) values (‘abcd’,’abcd’)

Is it possible via a word macro?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?SWFuIENsYXJr?=,
How can I insert into this table the following SQL syntax is – insert into
heatdb (dbname,tablename) values (‘abcd’,’abcd’)

Is it possible via a word macro?
No, you can't manipulate the result of a DATABASE field using SQL. What you
could, perhaps, do is use ADO to get the information, then automate the table
the DATABASE insertion creates to enter the information. I'm just not clear on
exactly what you're trying to accomplish, here.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
I

Ian Clark

Used ADO to accomplish the task

Many thanks


Cindy M -WordMVP- said:
Hi =?Utf-8?B?SWFuIENsYXJr?=,

No, you can't manipulate the result of a DATABASE field using SQL. What you
could, perhaps, do is use ADO to get the information, then automate the table
the DATABASE insertion creates to enter the information. I'm just not clear on
exactly what you're trying to accomplish, here.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)


This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top