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!

sql to determine field layout of table?

Status
Not open for further replies.

Dan01

Programmer
Jun 14, 2001
439
US
Is there a system table where one can programatically obtain field names and sizes for a given table? Thanks, Dan.
 
Dan

There is a table called MSysAccessObjects and another called MSysObjects, both will give you the information that you want, but an easier way is to use the DAO object library.
I have explained how to do this recently in the following thread:

thread705-568055 the field size is a slight adaptation of the code I have written there.

John
 
jrbarnett

If it isn't to much trouble, could you provide the info on decoding the MSysAccessObjects? All I see is the object Id field and an undecipherial field "Data". I would be interested in understanding the data and the decodeing process.

In earlier versions of Ms. A. the (table) field definitions were available in the hidden system tables. Since Ms. A. 2K, I am not able to find them, although they (obviously) are SOMEWHERE.

If MSysAccessObjects!Data decodes to reveal this, I for one would really like to know.



MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
MichaelRed,

I have had a quick look at the Data field in a test 2000 format database of mine in Access 2002 SR1 - I created a form based on MSysAccessObjects with a multiline textbox bound to the Data field, and looking, it just looks like gibberish and makes no real sense to me at all, with nothing obvious being anything in particular.

I opened each of the system tables in the relationships window, and there are no (predefined) links between them, and opening each in design mode, there are no comments against each field either.

I agree that data type and size used to appear in the system tables in Access 97 but don't have a system running that version easily to hand now for a thorough investigation to see if I can work out what has changed to what.
My apologies for not checking this was still available with the latest version before posting.

For what it's worth, my access documenter mentioned in the thread that I referred Dan01 to uses DAO code to operate, as I thought that selecting data from system tables was not the 'official' way of obtaining information, although it proved a little quicker than a For Each Next loop on a collection.
I am aware that this particular library has been superseded by ADO, but have not found an equivalent method of looping through each of the items in a collection, or obtaining metadata about database objects.

John
 
Well at least thanks for the reply. I would like to just be able to 'understand' the system tables. Ms. has maintained (SINCE the beginning of Ms. A. -or perhaps time itself) that the system tables are NOT guarnteed to stay the same between releases - much to MY chagrin, after writting some fairly extensive code in an early version which used the info available in that ver.



MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top