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!

alias field names 2

Status
Not open for further replies.

cheyenne2002

Instructor
Jul 26, 2005
229
US
Is there a way to create alias names for fields. I'm not sure if I'm explaining this right. I would like to use one of the templates offered by MS, but I need to link it to an existing database. The existing database has set field names that I can NOT change and I would like to just go in and tell Access that [field name1] is the same as [field name A].

Does anyone know if this is possible????? It would certainly make like a bit easier.

Sharon
 
Simply use a saved query as it were a table ...
SELECT [field name1] AS [field name A], [field name2] AS [field name B], ...
FROM yourTable ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Where can I learn more about this. I'm not sure how to do this. It looks and sounds like coding in SQL which I do not know how to do.

Any suggestions?

Sharon
 
If you open the query in design view, find the field you want to change the name of and type the new name and a : before the existing name.
Example, alias FName to display FirstName...

[tt]
Field ID FName
Table
Sort
Show
Criteria
Or
--------------------------------------
Field ID [red]FirstName:[/red]FName
Table
Sort
Show
Criteria
Or
[/tt]
 
Unfortunately, PHV's recommendation, which is indeed SQL, is the only way to do what you want since you can't modify the table definition.

You can use the query designer in Access or you can switch to SQL view which I find more convenient for this kind of thing and then just type something like
Code:
SELECT [field name1] AS [field name A]
     , [field name2] AS [field name B]
     , [field name3] 
     , [Other field] As [Other Field Name]
     , [red]etc. for each field that you want to see[/red]

From TableName
The [red]AS[/red] keyword just assigns a different name to the field in your query. If you don't use [red]AS [SomeName][/red] then the field name from the table is used (See [Field name3] above.)

Save the query with some meaningful name and use that query rather than the base table as your recordsource for a form.
 
Thank you both, I think I have it now. I just need to get back to the office tomorrow and give it a try.

Sharon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top