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!

using alias table names on form 1

Status
Not open for further replies.

dj982020

Programmer
Jun 11, 2004
27
US
I have a form that lists all of the tables in the database in a list box so that the user can select a table to view. I don't want the actual table names displayed in this list box.

EX. for iElements table, I want to see "Elements"
for iCombatDamageDefs table, I want to se "Combat Damage Definitions"

Please help me with this. I don't know how to have the alias name show up in the list box and open the appopriate table associated with the name selected.

TIA,
DJ
 
dj982020,

How are you "feeding" the list box?

You could create a query (with Select * from tblElements) then have the user "use" the query for all data operations. This way the "name" can be anything.

Or you can create a cross reference table of "alias" names.

tblMydataseTables
dspTableNam dbTableNam
Elements iElements
Operations iOperations
...

Use this table to populate your list box.

Hey just some ideas..


[thumbsup2]

 
I am using a table (like the one HitechUser described) to populate my list box.

I would like to use that table to grab the real names from. I think this would cause me to use a combination of VBA code and an SQL query.

DJ
 
dj982020,

You did not provide enough detail (after the user selects from listbox) how you are "switching" to the selected table. Use Dlookup on the alias table to get the "real" table name.


Code:
realTableName = DLookup "[dbTableNam]", "tblMyDatabaseTables", "[dspTableNam] = yourlistboxname " )

I hope this helps.



 
Thanks HitechUser!

For some reason, I had to enter a bunch of extra quotes, but it works!!

DJ

 
try
SELECT nz([tblMyDatabaseTables].[dspTableNam],[MSysObjects].[name]) AS Expr1
FROM MSysObjects LEFT JOIN tblMyDatabaseTablesON MSysObjects.Name = Tablenames.dbTableNam
WHERE (((MSysObjects.Type)=1) AND ((MSysObjects.Flags)=0)) OR (((MSysObjects.Type)=4));
this query will give the discriptive name when you have it and if you dont have a entry in the table it will give you the real name


 
anyone out there know where access stores the object description
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top