通过改变Detail.Height在MS Access调整表 [英] Resize form in MS Access by changing Detail.Height

查看:161
本文介绍了通过改变Detail.Height在MS Access调整表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望用户能够同时在窗体视图中通过点击一个按钮来改变窗体的高度:

I want the user to be able to change the height of the form while in Form View by clicking a button:

Private Sub btnChangeHeight_Click()

    booTall = Not booTall

    If booTall Then
        lngHeight = 12400   ' (twips)
    Else
        lngHeight = 1200
    End If

    Me.Detail.Height = lngHeight
    Me.Repaint

    Debug.Print Me.Detail.Height

End Sub

设置高度 - Debug.Print 是这么说的,和垂直滚动条出现在 booTall 但是表格不会改变其垂直尺寸在屏幕上。

The height changes -- Debug.Print says so, and a vertical scroll bar appears when booTall is True. But the form won't change its vertical dimension onscreen.

我也试过,但没有成功(确保我的按钮是表格标题上):

I also tried this, without success (making sure my button was on the Form header):

    Me.Detail.Visible = booTall

解决方案似乎依靠的形式和窗体主体节属性:可调整大小自动高度的,可能的可以增大的等但我摆弄那些并没有什么工作。

The solution would seem to depend on properties for the Form and Form Detail section: Resizable, Auto Height, perhaps Can Grow, etc. But I've fiddled with those and nothing works.

据我所知重叠控件和其他的东西可以prevent高度的调整,所以我的形式降低到最小布局。我使用的是Access版本2007/2010。

I understand overlapping controls and other things can prevent height adjustments, so I've reduced the form to a minimal layout. I'm using Access version 2007/2010.

一些额外的信息:我其实对我工作的两个子表单,(A)以上和(b)所示,它可以独立折叠成视图或扩大。这是一个决策的形式与它的数据很多。我想如果我崩溃了(A)的高度或(B)中,详细的可以缩小属性将导致整体形式层面的改变。其实,我觉得我这样做是在几年前使用Access 2003。至于使用最大化......我们正在建立这种形式,可重复使用,多个实例可以打开。

Some additional info: What I actually am working toward is two subforms, (A) above and (B) below, which can independently be collapsed out of view or expanded. This is for a decision-making form with a LOT of data on it. I thought if I collapsed the height of (A) or (B), the CanShrink property of Detail would cause the overall form dimension to change. In fact, I think I did this a few years ago using Access 2003. As for using Maximize ... we're setting up this form as re-usable, multiple instances can open.

推荐答案

......而在窗体视图通过点击一个按钮来更改表格的高度

使用表单的 .Move 方法来更改窗体的大小。此示例切换4044和8000之间缇我的窗体的高度。

Use the form's .Move method to change the form's size. This sample toggles my form's height between 4044 and 8000 twips.

Private Sub btnChangeHeight_Click()
    Dim lngHeight As Long

    If Me.WindowHeight = 4044 Then
        lngHeight = 8000
    Else
        lngHeight = 4044
    End If
    Me.Move Me.WindowLeft, Height:=lngHeight
End Sub

这篇关于通过改变Detail.Height在MS Access调整表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆