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

How to get a field size of a field in a table?

Status
Not open for further replies.

neemi

Programmer
May 14, 2002
519
GB
If I have set a field in a table to Field size 50. How can I use code to check what the field size is?

I have tried something like...

Code:
Table!TableName!FieldName.FieldSize

But can't get it to work?

Does anyone have any ideas?
 
Hi

Public Sub a()
Dim Db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
'
Set Db = CurrentDb()
Set tdf = Db.TableDefs("FA1")
Set fld = tdf.Fields("FORMULA_NO")
Debug.Print fld.Size

End Sub

You will need a reference to the DAO library to use this code

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Another simple option is
Code:
MsgBox CurrentDb.TableDefs("TableName").Fields("FieldName").Size


________________________________________________________________________
Zameer Abdulla
Visit Me
No two children are alike - particularly if one is yours and the other isn't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top