Query to Replace headers

Indep99

Registered User.
Local time
Yesterday, 23:58
Joined
Dec 21, 2011
Messages
23
Hello,
I have a linked table in Access that has generic names... I also have another table that matches each generic name to a full description name which lets the user know what the generic name means.
I want to create a query that will bring out the values from the table but with the field headers being the full description name... I tried an update query so far but it's not working...
Is there any way anyone knows how to do a vlookup and bring back the full description please as the header
 
This is an Access forum. We don't have a vLookup.

Consider 2 tables, since you haven't described yours:
Table1
GenId (autonumber PK)
GenericName (text)

Table2
DetId (autonumber PK)
GenId (number) FK
DetDesc (text or memo)

query along these lines (untested)
Select DetDesc from Table2 Inner Join
Table1 ON Table2.GenId=Table1.GenId

see http://www.techonthenet.com/sql/select.php for info
 
Hi
Sorry, it made sense until the end part...
Here is my situation

Table1
Headers: Field1 Field2
A Alpha
B Beta


Table2
Headers: A B
100 200
100 600

I want to extract the numbers from Table2 but replace the headers with the information I have from table1
so final result would be
Headers: Alpha Beta
100 200
100 600
 
You latest post material doesn't seem to relate to your original description

I also have another table that matches each generic name to a full description name which lets the user know what the generic name means.

Can you put some context around this? WHAT are you trying to do in business terms?
I made a comment about Access and Excel earlier. Do you understand Normalization? It will be necessary for Database work.
 
I am creating a query in Access that extracts data to an excel file, however the table in access has generic headers that are not understandable to users, as a result I wanted Access to replace the headers in the query with meaningful ones so that once it gets exported to Excel, users know exactly what it stands for
 
I am not an Excel person. What are Headers as compared to Field/Column Names?
Why are the Access tables set up so they make no sense to the user?
You can change a query to report different column/field names

eg

Select field1 as NewHeader, field2 as SomeOtherHeader from mytable.
 
sorry I meant headers are the field name... the system generates generic field names for each column
I can do the set as but there are 40 columns and I wanted to automate it somehow... so that it looks for field name x and based ona different table returns the value x = hello
 
Please explain why the field names are so different that people can't understand them.

You could build a table with the field names you want, and import your data into it. That way, at least to me, seems you can have the data values with the field names you want.
And it seems it could be repeated as needed.
Code:
INSERT INTO MyGoodNamesTable (GoodName1,GoodName2, GoodName3.. )
SELECT badname1,badname2, badname3...
FROM TheBadNameTable;
 
You could either use the SQL, as mentioned above by jdraw or, if you are using the query design view you can enter your columns as Alias:fieldName

Table 2
Headers: A B
100 200
100 600

By making the query and entering in the columns as Alpha:A, Beta:B the output should appear as:

Headers: Alpha Beta
100 200
100 600
 
Last edited:
You only have to set up the Table with the names you want - 1 time. So it isn't a difficult task. 1 time set up.
 
What you could do is keep your generic table and create a query, with proper headers to view / export it with as in the attached example. Again a 1 off task.
 

Attachments

Thanks guys but this is the situation for example
the generic table has tag1 tag2 tag3 as headers
and let's say this year tag1 could be location, tag2 could be name and tag3 could be dollars but next year the tags can change and therefore the names will be different. I wanted to set up a table where the user updates the "name" of the tags and from there access updates the queries output
 

Users who are viewing this thread

Back
Top Bottom