If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Resize cols when run: Docmd.OpenTable "myTable"
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 |
#2
|
|||
|
|||
Resize cols when run: Docmd.OpenTable "myTable"
On Tue, 28 Apr 2009 16:45:41 -0700 (PDT), AC wrote:
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. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#3
|
|||
|
|||
Resize cols when run: Docmd.OpenTable "myTable"
On Apr 29, 12:14*pm, fredg wrote:
On Tue, 28 Apr 2009 16:45:41 -0700 (PDT), AC wrote: 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. -- 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 |
Thread Tools | |
Display Modes | |
|
|