?
Solved

Programmatically resize subform datagrid display

Posted on 2004-10-14
2
Medium Priority
?
440 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:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
Jokra_the_Barbarian earned 2000 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:Tom 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

762 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