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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining Fields into One Column?

Status
Not open for further replies.

floydpepper

Technical User
Jul 8, 2004
39
US
Ladies and Gents,
I have a table with Employee Name, Class 1, Class, 2, ..., Class 24.

Is there a way to combine different fields (column headers) on a table into the content of a single column on a separate table (Class Names)?

Thank you in advance.

FloydPepper

 
it is possible in a query:

Code:
SELECT [Employee Name] & " " & [Class 1] & " " & [Class 2] AS EmpoyeeConcat from EmployeeTable;

HTH,
fly

[blue]Typos, that don't affect the functionality of code, will not be corrected.[/blue]

Martin Serra Jr.
[blue]Shared Database_Systems and _Applications across all Business_Areas[/blue]
 
Thank you for your help. I wasn't clear enough in my posting.

Here's what I'm trying to do:

I need to pull the names of the columns/fields (eg Biking 101, Basket Weaving 301) into a single column in a table so that I can use the class names as a source for a listbox.

I apologize for my vague question in the beginning. I hope this is more clear. Thank you.

FP
 
Yikes...the class names shouldn't be columns to begin with...check out PHV's link before you go any further.

As for the dirty answer to your question...open the table, highlight the first row, copy, paste it into Excel which will show all the column names. Then highlight the column names in Excel, copy, paste special, transpose...that should get them all in a list for you.

But to avoid future headaches you should change your table setup...
 
besides the very important discussion about relational database design and normalization, there is a very simple solution for your problem:

you said you wanted the column names listed in a listbox. so set the rowsource type property of your listbox to "Field List" and as rowsource select your table with Employee Name, Class 1, Class, 2, ..., Class 24. Now the listbox will show all column names of your table. If you want to restrict the fieldlist to only certain column names (e.g. all columns starting with "Class*", you would have to do some VBA coding, I assume. Let me know, if you need more help with this.

Greetings,
fly

[blue]Typos, that don't affect the functionality of code, will not be corrected.[/blue]

Martin Serra Jr.
[blue]Shared Database_Systems and _Applications across all Business_Areas[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top