Resize cols when run: Docmd.OpenTable "myTable"

A

AC

Hi

I am running some vba which opens a table, and the default column
width it uses is much much too small for the text contained in the
field. Is there any way to either resize it via the code, or to get
it to use a more sensible value?

The table opens with the field only wide enough to show 14 characters,
which as an aside is also smaller than the field name let alone the
size of the data.


My code is something like:

'Drop the temp table if it exists
DropTable("t_temp") '<--- THIS IS A CUSTOM ROUTINE I HAVE

'Create a temp table
Set tdf = db.CreateTableDef("t_temp")
With tdf
.Fields.Append .CreateField("Unknown_Scenario_Filename",
dbText, 255)
End With
db.TableDefs.Append tdf
db.TableDefs.Refresh
Application.RefreshDatabaseWindow

'Put some data into this table
<puts various rows of data into the table, the data is full
file and path names so can be quite long >

'Open this table
DoCmd.OpenTable "t_temp"



Thanks in advance
AndyC
 
F

fredg

Hi

I am running some vba which opens a table, and the default column
width it uses is much much too small for the text contained in the
field. Is there any way to either resize it via the code, or to get
it to use a more sensible value?

The table opens with the field only wide enough to show 14 characters,
which as an aside is also smaller than the field name let alone the
size of the data.

My code is something like:

'Drop the temp table if it exists
DropTable("t_temp") '<--- THIS IS A CUSTOM ROUTINE I HAVE

'Create a temp table
Set tdf = db.CreateTableDef("t_temp")
With tdf
.Fields.Append .CreateField("Unknown_Scenario_Filename",
dbText, 255)
End With
db.TableDefs.Append tdf
db.TableDefs.Refresh
Application.RefreshDatabaseWindow

'Put some data into this table
<puts various rows of data into the table, the data is full
file and path names so can be quite long >

'Open this table
DoCmd.OpenTable "t_temp"

Thanks in advance
AndyC

1) Don't use a table to enter or view data. Use a Form.
2) Tables are for data storage, not viewing. Use a Form
3) One of the surest way to have users corrupt your data is to allow
users access to tables. Use a form.
4) Use a form. In Form Single or Continuous View, you can then size
the individual controls however you wish.
 
A

AC

1) Don't use a table to enter or view data. Use a Form.
2) Tables are for data storage, not viewing. Use a Form
3) One of the surest way to have users corrupt your data is to allow
users access to tables. Use a form.
4) Use a form. In Form Single or Continuous View, you can then size
the individual controls however you wish.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail- Hide quoted text -

- Show quoted text -

OK, fair point Fred

However - I would still like to know if there a way to do this?

Thanks
AndyC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top