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!

tablefields layout autosize

Status
Not open for further replies.

JeroenNL

Programmer
Nov 28, 2002
217
NL
Hi there,

I create a bunch of tables at runtime. When I view the contents of these tables in a subform, the field widths of the grid aren't really convinient. So I want them to be autosized or something. Right now I have to select the entire grid and doubleclick between two fields so all fields are sized correctly. Then I save the changes made to the table layout. Is there any way to do this automatically?

Thanks,
Jeroen
 
I've posted a Tip at thread705-457901, which now you've reminded me, thanks, includes how to specify the Column Width of a Field.

If you can judge the width of your Fields, hopefully it should come in useful.

Or if you prefer maybe you can use this example I copied from help.

The following example changes the row height in Datasheet view of the Customers table to display two lines of data (450 twips) and sets the width of the Address column to 1.5 inches (2160 twips). These property settings will take effect the next time the Customers table is opened in Datasheet view.
To set the RowHeight and ColumnWidth properties, the example uses the SetTableProperty procedure, which is shown in the example for the DatasheetFontItalic
and DatasheetFontUnderline properties, and the SetFieldProperty procedure, which is shown in the example for the ColumnHidden property.

Dim dbs As Database, tdfCustomers As TableDef
Set dbs = CurrentDb
Set tdfCustomers = dbs![Customers]
SetTableProperty tdfCustomers, "RowHeight", dbLong, 450
SetFieldProperty tdfCustomers![Address], "ColumnWidth", dbInteger, 2160

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top