Solved

Programmatically resize subform datagrid display

Posted on 2004-10-14
2
436 Views
Last Modified: 2008-02-01
I need a way to programmatically adjust the size of the columns in a subform so the scrollbar goes away.

Something akin to double-clicking the column seperators to force them to the size of the header.

Here is a picture depicting what I want to accomplish:

http://www.robotzgame.com/junk/subform_resize.gif

Thanks,

Tom
0
Comment
Question by:knowlton
2 Comments
 
LVL 11

Accepted Solution

by:
Jokra_the_Barbarian earned 500 total points
ID: 12309144
Try this:

Dim ctl  As Control
   
        For Each ctl In Me.subform1.Form.Controls
               If ctl.ControlType = acTextBox And ctl.Properties("visible") = True Then ' Only set the width for visible textboxes
                    ctl.SetFocus
                    SendKeys "%B", False
                    DoCmd.RunCommand (acCmdColumnWidth)
                End If
        Next ctl
0
 
LVL 5

Author Comment

by:knowlton
ID: 12309334
Or how about this?

Private Sub ResizeCommentsSubForm()
    Forms![frmEntriesForm]![frmCommentsSUB]![TimeStamp].ColumnWidth = -1
    Forms![frmEntriesForm]![frmCommentsSUB]![CommentType].ColumnWidth = -1
    Forms![frmEntriesForm]![frmCommentsSUB]![Comment].ColumnWidth = 4000   'twips
End Sub

(I found my old code for handling this)
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question