A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Resize cols when run: Docmd.OpenTable "myTable"



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2009, 12:45 AM posted to microsoft.public.access
AC[_2_]
external usenet poster
 
Posts: 20
Default 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  
Old April 29th, 2009, 01:14 AM posted to microsoft.public.access
fredg
external usenet poster
 
Posts: 4,386
Default 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  
Old April 29th, 2009, 01:40 AM posted to microsoft.public.access
AC[_2_]
external usenet poster
 
Posts: 20
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.