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

Using column name as a field value in query result

Status
Not open for further replies.

strangeryet

Programmer
Jul 8, 2004
159
US
Hello,
Is it possible to use a column name as part of a query result.
for example
Column names
Values

Product1,Product2
1235xyz, 1234ads
3422xdr, 234dnfb
4234ser, 1dae4r3

for a result looking like:
Product1, 1235xyz
Product1, 3422xdr
Product1, 4234ser
Product2, 1234ads
Product2, 234dnfb
Product2, 1dae4r3

Keep in mind the column names change and are imported from excell
so they can't be hard coded in the query. I want a way to bring back the various column names as part of the result.
Thanks
 
I don't believe there is a pure SQL solution. You would need code to do this. If you post an actual table and sample field names I expect someone could help you with the code that would normalize your Excel import.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top