vba 在 MS Access 窗体的子窗体中,如何根据需要隐藏/显示垂直滚动条?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2463623/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 11:26:06  来源:igfitidea点击:

In subform of a MS Access form, how to hide/show the vertical scroll bars as needed?

ms-accessvba

提问by PowerUser

I have a subform in an MS Access form which is not hiding/showing the vertical scroll bars as needed. In the example picture, the vertical scroll bar is showing even though there aren't enough records to warrant vertical scrolling. How do I get the scroll bars to show only when they are needed? Do I need to add an if-then condition to the on_load event? or is there an easier option?

我在 MS Access 表单中有一个子表单,它没有根据需要隐藏/显示垂直滚动条。在示例图片中,即使没有足够的记录来保证垂直滚动,也会显示垂直滚动条。如何让滚动条仅在需要时显示?我是否需要向 on_load 事件添加一个 if-then 条件?或者有更简单的选择吗?

Example http://www.freeimagehosting.net/uploads/37834d1d76.jpg

示例 http://www.freeimagehosting.net/uploads/37834d1d76.jpg

采纳答案by Fionnuala

You may find something on these lines suits:

您可能会在这些线路套装上找到一些东西:

 If Me.Recordset.RecordCount > 10 Then
      Me.ScrollBars = 2 ''Vertical only
 Else
      Me.Scrollbars = 0 ''Neither
 End If