#1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] jamiechen168@gmail.com is offline
external usenet poster
 
Posts: 6
Default Rename a column

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.

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Rename a column

You will need to change the names of the fields in the .csv file.

--
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

wrote in message
oups.com...
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.



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Rename a column

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

wrote in message
oups.com...
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.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting a Full Width Table in a 2 Column Document BJC Page Layout 3 May 17th 23 08:48 AM
table column width problems Dena Tables 2 March 8th 05 03:51 AM
formatted paragraph shading top of 2nd column appears bottom 1st c Nadia Microsoft Word Help 3 February 17th 05 04:03 AM
Dragging table column resets Sedonakids Tables 0 January 12th 05 01:11 AM
Not your average Word column question - help! John Microsoft Word Help 6 January 11th 05 04:32 AM


All times are GMT +1. The time now is 01:11 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"