Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 17th, 2007, 02:01 PM
Registered User
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Best Fit Column Width for Datasheets

Michael Kaplan's paper on datasheets
http://msdn2.microsoft.com/en-us/li...office.11).aspx states,

"If you need to do the same task with a Form [resize columns programatically to display the data currently in the column], it's even easier: Just set all of the ColumnWidth properties to -2. No extra steps are needed."

So in the Form_Open event procedure on my tabular form I'm setting the ColumnWidth property of each control to -2. But the datasheet view does not properly size the columns. What am I missing?

Thanks much!

AppBuilder
 
Old January 18th, 2007, 08:43 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Can you post a link to the article. I am not sure what you are trying to do and the link does not work.


mmcdonal
 
Old January 25th, 2007, 06:21 PM
Registered User
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for the reply mmcdonal. Here is the link:

http://msdn2.microsoft.com/en-us/library/aa217449(office.11).aspx

I'm trying to programmatically set up a datasheet view so that each column sizes to the width of the data that is being displayed.

Thanks again,
Nadine

AppBuilder
 
Old January 26th, 2007, 08:22 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Another question then:

Are you trying to resize the columns on a subform, or form? You mention a tabular form, and datasheets. Datasheets indicates a subform. Perhaps you have this on the wrong form. Open just the subform in design view, and put this code on the SUBform's On Open event.

Did that help?


mmcdonal
 
Old January 28th, 2007, 04:45 PM
Registered User
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you again, mmcdonal.

This is a top level form, not a subform. The columns are filled from a query that changes each time the form is run, so that different columns from the underlying table get displayed on different runs. The user can look at the form in the normal forms view or switch to the datasheet view. In the datasheet view, I'd like the column widths to resize to match the data width.

Thanks much,
Nadine

AppBuilder





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to fit all column in 1 page in excel format? awiezzz Classic ASP Components 2 February 23rd, 2011 01:42 PM
How to set Column width harapraveen XSLT 2 October 23rd, 2007 03:14 AM
expanding datagrid to fit to its column text connect2sandeep General .NET 1 August 23rd, 2005 10:59 AM
Setting Column Width r_ganesh76 Excel VBA 2 February 2nd, 2005 06:06 AM
Column width immanuelsamuel Oracle 2 March 13th, 2004 10:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.