Changing Column Heads in Listbox

Y

YorkieU

I have a listbox that shows the Column Heads from an sql string in the
Rowsource. I want to change the column heads to something other than the
actual Field_Name. Is this possible? If so, How? I've tried to use a query
and set the Caption of the selected field, but that doesn't work. Thanks for
any help.
 
B

Banana

I believe you would do so by using alias:

SELECT Column_1 AS MyHeading1, Column_2 Heading2
....

where 'Column_x' is the actual field name while 'Myheadingx' is the
alias and thus will be what is displayed.
 
R

Ron Weiner

You can Alias the colum name in you query like:

SELECT Column1 as YourName, Column2, as AnotherName
FROM YourTable ...

Ron W
 
Y

YorkieU

Thanks guys but this does not work. I tried it before I tried the "Caption"
for the field. Niether changes what is displayed in the Listbox Headings.
Hoping for some other solution, other than putting individual Labels on top
of the listbox to "Act" as Column Headers.
 
Y

YorkieU

Well my Original is quite a long string so I did some testing with a more
simple string on a new blank form.

"SELECT tblSubjects.SubjectID, tblSubjects.Subject AS Teachable_1 FROM
tblSubjects;"
What appears in the Heading for the Subject field is "Subject" ???.......

BUT; just as I was about to post this, I did some further testing & found
that I had the Caption set at the TABLE LEVEL, and once this was removed,
All is well. Your suggestion works. So, if the caption is set at the table
level it overrides all.
Thank very much you for the help...
 

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