Hello,
I inserted a database field to my word doc with data from .csv file. Am
I able to change the name of column to make the column header more
meaningful?
Test.doc =
.....
{ DATABASE \d "C:\\Temp\\Data.csv" \c "" \s "SELECT OrderItem_id,
OrderItem_price FROM C:\\Temp\\Data.csv" \l "3" \b "191" \h }
As you know, Word will display above as a table with 2 columns,
"OrderItem_id" and "OrderItem_price" for the column header. Is there a
way I can change the column header's text to something else?
I tried to change the select statement to become ".... SELECT
OrderItem_Id as ID...." but it didn't work either.
Please help.
Doug Robbins - Word MVP - 06 Sep 2006 04:30 GMT
You will need to change the names of the fields in the .csv file.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Hello,
>
[quoted text clipped - 15 lines]
>
> Please help.
Peter Jamieson - 06 Sep 2006 10:36 GMT
For a .csv file in Word 2003 (and possibly Word 2002, you can try this:
Create a file in c:\\temp called t.udl, e.g. using Notepad. It doesn't have
to have anything in it.
Use the following DATABASE field:
{ DATABASE \d "C:\\Temp\\t.udl" \c "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\temp\\;Mode=Share Deny None;Extended Properties=\"HDR=YES;\";Jet
OLEDB:Engine Type=96;" \s "SELECT OrderItem_id as ID,
OrderItem_price FROM Data.csv" \l "3" \b "191" \h }
If you have spaces in your alias name (e.g. "Item ID") or file name , quote
the name using backquotes `` or square brackets [ ] but not straight quotes
'' or \"\".
e.g.
{ DATABASE \d "C:\\Temp\\t.udl" \c "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\temp\\;Mode=Share Deny None;Extended Properties=\"HDR=YES;\";Jet
OLEDB:Engine Type=96;" \s "SELECT OrderItem_id as [item ID],
OrderItem_price FROM Data.csv" \l "3" \b "191" \h }
Peter Jamieson
> Hello,
>
[quoted text clipped - 15 lines]
>
> Please help.