vba 如何在 MS Access Form 中的表格中显示记录数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11910449/
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-08 13:45:04  来源:igfitidea点击:

How to display record data in a table in MS Access Form

vbams-accessvbscriptms-officeoffice-2010

提问by Kobojunkie

I am working in Offiice Access on a form. I notice that there are not a lot of controls available to use but I have a requirement to display data in a table like structure(not listbox or combobox). How can I accomplish this please?

我正在使用 Office Access 处理表单。我注意到没有很多控件可供使用,但我需要在结构(不是列表框或组合框)之类的表格中显示数据。请问我怎样才能做到这一点?

回答by Albert D. Kallal

Actually, one of the truly great features in Access is what we call a continues form. A continues form is simply a form in which you can place any kind of control you want, the magic trick part is those controls will repeat over and over for you for each row of detail - the result is a grid, and I dare say one of the most powerfull grid controls avaialble - it is fully programable with VBA.

实际上,Access 中真正出色的功能之一就是我们所说的连续表单。连续形式只是一种形式,您可以在其中放置您想要的任何类型的控件,魔术部分是这些控件将为您一遍又一遍地重复每一行细节 - 结果是一个网格,我敢说一个最强大的网格控件可用 - 它完全可以用 VBA 编程。

Not only does such a setup give you one of the best grid controls that our IT industry has ever seen, but it is very little work on your part to create this marvels.

这样的设置不仅为您提供了我们 IT 行业有史以来最好的网格控件之一,而且您只需很少的工作就可以创造这种奇迹。

So you can drop pictures, even buttons, check boxes and even combo boxes. They will all repeat as a grid for you.

因此,您可以删除图片、甚至按钮、复选框甚至组合框。它们都将作为您的网格重复。

So here is an easy screen to create in Access:

所以这里有一个在 Access 中创建的简单屏幕:

enter image description here

在此处输入图片说明

And here are a few more ideas. Note that some of these are Access web forms, but all of the look + feel is available for client forms or web forms.

这里还有一些想法。请注意,其中一些是 Access Web 表单,但所有外观都可用于客户端表单或 Web 表单。

So keep in mind that the new full web effects forms that can run in a browser, or even client only forms can use these new effects such as shadow, hover effect etc.

因此请记住,可以在浏览器中运行的新的完整 Web 效果表单,甚至仅客户端的表单都可以使用这些新效果,例如阴影、悬停效果等。

enter image description here

在此处输入图片说明

and this one:

和这个:

enter image description here

在此处输入图片说明

and

enter image description here

在此处输入图片说明

The above is VERY cool since I dropped in a rich text control and bound it to a function. the result is a column that displays the diffenrce between the two rows in Red. How cool is that?

以上非常酷,因为我放入了一个富文本控件并将其绑定到一个函数。结果是一列,以红色显示两行之间的差异。多么酷啊?

All of the examples above are what we call a continues form in Access and were built with very little effort and all of the above examples are 100% built only using Access forms, including the graphics for the buttons with shadows.

上面的所有示例都是我们在 Access 中称为“继续”表单的内容,并且构建起来非常简单,上面所有示例都是 100% 仅使用 Access 表单构建的,包括带有阴影的按钮的图形。

回答by Fionnuala

There are a lot of controls. You can add a subform, which will display a continuous form or a datasheet, or even a query or table. You can switch the form itself to datasheet view or continuous form.

有很多控件。您可以添加一个子表单,它将显示一个连续的表单或数据表,甚至是一个查询或表。您可以将表单本身切换到数据表视图或连续表单。