Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 17th, 2007, 01:01 PM
Registered User
 
Join Date: Jan 2007
Location: , , .
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
__________________
AppBuilder
Reply With Quote
  #2 (permalink)  
Old January 18th, 2007, 07:43 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
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
Reply With Quote
  #3 (permalink)  
Old January 25th, 2007, 05:21 PM
Registered User
 
Join Date: Jan 2007
Location: , , .
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
Reply With Quote
  #4 (permalink)  
Old January 26th, 2007, 07:22 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
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
Reply With Quote
  #5 (permalink)  
Old January 28th, 2007, 03:45 PM
Registered User
 
Join Date: Jan 2007
Location: , , .
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
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 12: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 05:06 AM
Column width immanuelsamuel Oracle 2 March 13th, 2004 09:30 AM



All times are GMT -4. The time now is 11:31 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.