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

Get properties of a table?

Status
Not open for further replies.

nerram

Programmer
Apr 23, 2003
56
IE
How do i get the properties of a table via sql. That is if i had create a table with Create Table(field VARCHAR(10), .. how can i retrieve this property later it later?
 
This isn't SQL, but you can retrieve all of a tables properties by referencing the TableDefs collection.

Dim dbs As DAO.Database
Dim tdf As Tabledef

Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
MsgBox tdf.Name & " " & tdf.Fields.Count
Next tdf

Good Luck!

 
And you won't find any VarChar(10) fields in an Access table either

What board did you think you were posting to ?


G LS
 
Yes it "treats" it that but it won't report it back as such.



Dooh ! I see what I've done. I mis interpreted the original post as nerram was expecting to get VarChar(10) back.

Maybe I'll just go back to reading lessons !



Graham
 
I try and explain myself a wee bit better:

I create a table using JDBC in an access database. I use Varchar(10) to specify i want a text field of ten characters
i.e. text(10) as mentioned above. I now, at a different stage of the project, am entering data into the database. I need to know the length of the field so i can validate input on the client side. The reason i am using varchar as this is a kinda cross platform way of saying text. Therefore my code will work using a MySql database. The main point is how do i get the length of the field back. Where else could i post this? I am kinda new to the website
 
Do you actually want the length of the FIELD - which by your own statement is TEN - you know that, so why go and find it out again?

OR

Do you want to find out the ACTUAL length of the text in a particular record that is stored in this field - could be any number up to ten.


????



G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
Scenario A I want the actual length of the field. I am trying to write want be described as a client side trigger. I want to be able to use the same code for all text fields to make sue they do not exceed their required length.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top