Database field code

B

BillBarclift

The following works fine:

{ DATABASE \d "C:\\Documents and Settings\\billb\\Desktop\\Junk.xls"
\c "RevInfo" \s "SELECT PageNumber, RevDate FROM C:\\Documents and
Settings\\billb\\Desktop\\Junk.xls WHERE PageNumber=3" }

The following does not work when I try to replace pagenumber with the
field code for page number:

{ DATABASE \d "C:\\Documents and Settings\\billb\\Desktop\\Junk.xls"
\c "RevInfo" \s "SELECT PageNumber, RevDate FROM C:\\Documents and
Settings\\billb\\Desktop\\Junk.xls WHERE PageNumber = { PAGE \*
MERGEFORMAT }" }

I've tried several variations of this with no success...any ideas?

Also, can someone can tell me how to replace the hardcoded path
(filename will be known, but directory will always be same as the word
file)?

Thanks in advance,

Bill
 
P

Peter Jamieson

A similar Database field works OK here, except I removed \*MERGEFORMAT which
you do not need.

Questions - neither of the following two things seems likely but they are
the only things I can think of right now:
a. Are the {} around the PAGE field the ordinary {} you can type on the
keyboard? If so, they will not work - use ctrl-F9 to insert a pair of the
special field code braces and type PAGE in between them.
b. What is the result of the { PAGE } field (e.g. if you execute such a
field outside the { DATABASE } field? If the result is something like 2-5 or
iii then the comparison will not work as you expect - in that case, you
might need to change the format of your page numbers or use a different
formatting switch such as \*Arabic to return a number. If you are expecting
the result to be (say) 1, ensure { PAGE } actually returns 1 and not 0. If
there is no record where PageNumber = 0 the DATABASE field will fail.

It looks to me as if you are probably using Word 2000 or earlier and/or
connecting using DDE, but if none of the above helps, which version of Word
are you using?
 

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