Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column name in ListBox 1

Status
Not open for further replies.

Tronsliver

Technical User
Sep 19, 2000
120
0
0
US
I built a listbox and populated it by using Rowsource with and SQL statement. Is it possible to change the column names the query provides to the listbox via VB? If so could I request an example.

Thanks
 
If your Query like
Select Column1, Column2
change it to
Select Column1 as ThenameYouWant, Column2 As TheNameYouWant
and so forth :)

Luck
TIA
 
Hi!

Open the property sheet for the list box and click on the Format tab. Find the property Column Heads and change it to yes. In VBA it is Me!YourListBox.ColumnHeads = True

hth


Jeff Bridgham
bridgham@purdue.edu
 
Jebry,
how is this
Me!YourListBox.ColumnHeads = True
will change column name as wanted ?
just curious...

Like I said "Never understood true meaning of True" ;)
TIA
 
Tlady,

Here is my code. How will the compiler know what field to look for in the query if I change the name?

sql = "SELECT qryExcess.sidstrNAME_IND,"
sql = sql + " qryExcess.sidstrGR_ABBR_CODE, "
sql = sql + " qryExcess.sidstrDUTY_POSN,"
sql = sql + " qryExcess.sidstrDY_POSN_QUAL,"
sql = sql + " qryExcess.sidstrAUTH_PARA_DSG,"
sql = sql + " qryExcess.sidstrAUTH_LINE_DSG,"
sql = sql + " qryExcess.sidstrPMOSD_ENL ,"
sql = sql + " qryExcess.sidstrSMOSD_ENL,"
sql = sql + " qryExcess.sidstrAMOSD_ENL "
sql = sql + " FROM qryExcess WHERE (((qryExcess.orgstrPrNbr)"
sql = sql + " = '" & Format(varx) & "'));"

Thanks

Roger
 
I hate this types, but give a shot
sql = "SELECT qryExcess.sidstrNAME_IND AS NEWNAME,"
sql = sql + " qryExcess.sidstrGR_ABBR_CODE AS NEWNAME, "
sql = sql + " qryExcess.sidstrDUTY_POSN AS NEWNAME,"
sql = sql + " qryExcess.sidstrDY_POSN_QUAL AS NEWNAME,"
sql = sql + " qryExcess.sidstrAUTH_PARA_DSG AS NEWNAME,"
sql = sql + " qryExcess.sidstrAUTH_LINE_DSG AS NEWNAME,"
sql = sql + " qryExcess.sidstrPMOSD_ENL AS NEWNAME,"
sql = sql + " qryExcess.sidstrSMOSD_ENL AS NEWNAME,"
sql = sql + " qryExcess.sidstrAMOSD_ENL AS NEWNAME"
sql = sql + " FROM qryExcess WHERE (((qryExcess.orgstrPrNbr)"
sql = sql + " = '" & Format(varx) & "'));"

 
TLady works great thanks...is there a way to change the color of the names? I would like to have the headings a different color than the data under the headings?
 
I am so glad ...
I'll see what i can do in an hour, OK !
BTW how about STAR ?

Remember my thread about STARs - I consider thread 'answered' when I see one, so it saves time to those who want to help, but has limited time :)
 
I thought I gave you one...did it not take..let me know and I'll give it to you again..:) thanks for color help I appreciate it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top