Query Word 2003

S

Steve54

Hello,
Could someone provide a little assistance, I’m running a query using Office
Word 2003 sp3, Database toolbar. I walk through the wizard. I select Query
Option s, Filter Records, Sort Records and Select Fields, when I remove the
fields from the select records option, and leave only the field I wand in my
report, when I complete the report all the fields are showing up in the
report. Is there a way to add only the fields that I select? I’ve tried using
Excel Word and Access I get the same results. My data is in Access query.
I’m using Windows XP Pro. Sp3 and Office Word 2003 sp3, and Office Access
2003 sp3,
 
P

Peter Jamieson

Are you inserting the database as a field? If so, can you
a. Use Alt-F9 to display the DATABASE field. You'll see something
along the lines of:

{ DATABASE \d "C:\\wbdb\\Artikel.mdb" \c
"Provider=Microsoft.Jet.OLEDB.4.0;Password=\"\";User ID=Admin;Data
Source=C:\\wbdb\\Artikel.mdb;Mode=Read;Extended Properties=\"\";Jet
OLEDB:System database=\"\";Jet OLEDB:Registry Path=\"\";Jet
OLEDB:Database Password=\"\";Jet OLEDB:Engine Type=5;Jet OLEDB:Database
Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk
Transactions=1;Jet OLEDB:New Database Password=\"\";Jet OLEDB:Create
System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't
Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica
Repair=False;Jet OLEDB:SFP=False" \s "SELECT `Artikelname`,
`Liefereinheit` FROM `Artikel`" \h }

Can you copy/paste the text between the {} and post it in a reply to
this message?

b. If you have selected fields, you should see a list of fields in the
SELECT statement, cf.

"SELECT `Artikelname`, `Liefereinheit` FROM `Artikel`"

If you see

"SELECT * FROM `Artikel`"

then for some reason your selection has not been remembered and you need
to replace the * by a list of the fields you want, then re-execute the
field. (I doubt if this has happened).

Another possibility is that you need to "alias" your field names. In the
past I've had to do that because there seemed to be a fault in the code
Word used to get data, and usuing an alias, though syntactically
unnecessary, seems to fix the problem. As I test right now, I can't see
it, so maybe that's been fixed. But in the above example, you would need
to change the SQL to something like

"SELECT A.`Artikelname`, A.`Liefereinheit` FROM `Artikel` A"

then re-execute the field.

Finally, if you are /also/ doing a mail merge, or connected to a mail
merge data source, there can be conflicts (as a result of another error
in Word) between the names retrieved from the mail merge data source and
the DATABASE field. Not sure that is relevant, but something to look out
for.

Peter Jamieson

http://tips.pjmsn.me.uk
Visit Londinium at http://www.ralphwatson.tv
 
S

Steve54

Hi Peter.
Thanks for your reply, I’m going create some new data files and start all
over again. I was using the same files to practice mail merge. As well using
the same files with access word and excel. I’m maybe only a level 200 using
word, I have very little experience with VBA code. I’ll repost when I
complete my next task.Thanks
 
P

Peter Jamieson

I have very little experience with VBA code

Just in case there is any misunderstanding, the code I showed isn't VBA
code - it's the code in a "Word field." So you don't really need to dive
into VBA to understand it.

Word fields are typically used to insert "variable stuff" of various
types, e.g. { PAGE } is used to insert a page number, { DATE } inserts
the current date etc. The key things to know about fields are that on a
typical Windows Word system
a. The {} are not the ordinary keyboard characters. If you want to
insert a field manually you can use ctrl-F9 to insert a pair of the
special "field code braces"
b. Alt-F9 toggles between "field code" view and "field results" view.
c. some field results are updated automatically in some circumstances,
e.g. when you open the document, print etc. DATABASE fields are not. To
update a field result manually, select the field and press F9.

As far as DATABASE fields are concerned,
a. they don't tend to work so well if the table they insert extends
over more than one page
b. although they still work in Word 2007, there is no equivalent of
the database toolbar in the standard User Interface - i.e. as far as MS
is concerned, they are probably regarded as a little-used feature. MS
also made a change a couple of versions back that make DATABASE fields
significantly less useful than they used to be.

Peter Jamieson

http://tips.pjmsn.me.uk
Visit Londinium at http://www.ralphwatson.tv
 

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