Solved

Programmatically resize subform datagrid display

Posted on 2004-10-14
2
432 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now