By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,301 Members | 1,752 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,301 IT Pros & Developers. It's quick & easy.

Datasheet forms and column widths

P: n/a
Can I have a datasheet form automatically "fit" the column widths when
the form opens?

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You can set the ColumnWidth property of the individual columns to -2 to
adjust each column width to fit the size of the visible text.

For example:

Forms![Customers]![Address].ColumnWidth = -2
--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
<dh*****@daubert.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
Can I have a datasheet form automatically "fit" the column widths when
the form opens?
Nov 13 '05 #2

P: n/a
I do not know of anyway to set the columns widths at the datasheet level.
However, if you name your textboxes systematically (for example, "txt...")
you can loop through the controls collection and set their column width
according.

Dim ctl as Control

Dim ctl As Control

For Each ctl In Me.subfrm.Controls
If Left(ctl.Name, 3) = "txt" Then
ctl.ColumnWidth = -2
End If
Next ctl
--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
<dh*****@daubert.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
Can I have a datasheet form automatically "fit" the column widths when
the form opens?
Nov 13 '05 #3

P: n/a
For programmatic control for forms in Datasheet view my standard
response is:
1) Michael Kaplan has an excellent article on manipulating Datasheets
here:
http://msdn.microsoft.com/libr*ary/d...y/e*n-us/dnsma
rt01/html/sa01b1.asp
2) An API solution is here:
http://www.lebans.com/autocolu*mnwidth.htm
The AutoSizing project also contains a method to FREEZE the
ColumnWidths.
--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
<dh*****@daubert.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
Can I have a datasheet form automatically "fit" the column widths when
the form opens?


Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.