{DATABASE} and {DOCVARIABLE}

R

Robert Thornton

I am trying to insert a database into a document using
{DATABASE} and I am getting an error that the document was
unable to open the data source. The name and location of
the data source changes depending on the situation, so I
am attempting to use {DATABASE \d {DOCVARIABLE datasource}
\s "select * from {DOCVARIABLE datasource}". Here is
where the problem lies. If I manually type in the path to
the data source in the \d parameter, the data merges and
everyone's happy and I keep my job. It seems that the
{DOCVARIABLE} works fine in the \s, but not \d.

Here's what's even stranger. The problem only exists in
Word 2000 on Windows 98. I have not been able to
reproduce the problem anywhere else. If I upgrade the
Office 2000 to Office XP, the first time I try to perform
the operation I get a message that the feature is not
working properly and needs to be repaired. Office then
installs some unknown file or option and the problem goes
away.
 
P

Peter Jamieson

My guess is that the syntax required to make the SELECT statement work
varies according to the data source type and the method WOrd uses to connect
to it. If you actually create a regular { DATABASE } field in Word 2000 on
Win 98, does Word use exactly the same text after "from" as you are storing
in { DOCVARIABLE datasource } ? I find that Word often insists that you use
table alias names that aren't strictly necessary.
 
D

Doug Robbins - Word MVP

Hi Robert,

Assuming that datasource is the name of the document variable, as a minimum
you need { DOCVARIABLE "datasource" }

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
R

Robert Thornton

The error actually occurs in the \d parameter. The \s or
SELECT statement seems to work without a problem. When I
use the { DOCVARIABLE datasource } or {
DOCVARIABLE "datasource" } or even \"{ DOCVARIABLE data
source }\" in the \d parameter I get the error. You did
spark an intresting idea though. The data source has the
file extension .htm. Could it be that Word is attempting
top use a converter that isn't installed or something? I
though that that was a native data source option and
woulnd't require a specific connection string. I am going
to try various file extensions and see if there is any
change. I appreciate all the help! I will post my
findings when I'm done.

Rob
 
C

Cindy M -WordMVP-

Hi Robert,

.htm file format does require a converter, so that could be
a problem. If you insert a Database field for such a file
manually and compare the Database field code perhaps you'll
see a difference?
Could it be that Word is attempting
top use a converter that isn't installed or something? I
though that that was a native data source option and
woulnd't require a specific connection string.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep
30 2003)
http://www.mvps.org/word

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