如何在数据表中以相同的形式显示查询结果?
我有一个搜索表单,您可以在其中输入用户要搜索的条件。然后,当我单击“搜索”按钮时,查询结果将以单独的形式显示。我想要发生的是,在搜索表单中显示查询结果。有谁知道我应该做什么(一步一步)及其代码?谢谢!
I have a Search form where you can input the criteria the user will be searching for. Then when I click the Search button, the query results will show in a separate form. What I want to happen is, show the the query results in the Search form. Does anyone know what I should do (step by step) and the code for it? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 Allen Browne 的搜索条件表单示例作为搜索表单的基础。他提供了一个 Access 2000 格式的示例数据库以及一个显示表单背后的代码。
编辑:您希望查询结果以相同形式呈现为数据表。 AFAIK,无法在数据表视图的表单上显示搜索控件。如果连续形式可以接受,布朗先生的例子应该更容易让你适应。但是,如果必须在数据表视图中获得查询结果,则可以将子窗体(其“默认视图”属性设置为“数据表”)添加到搜索窗体。但是,该方法将要求您将过滤器应用于子表单而不是主表单。
You can use Allen Browne's Search criteria form example as the basis for your search form. He provides a sample database in Access 2000 format and also a page which displays the code behind the form.
Edit: You wanted your query results presented as a datasheet in the same form. AFAIK, there is no way to display your search control on a form in datasheet view. If a continuous form is acceptable, Mr. Browne's example should be easier for you to adapt. But if you must have the query results in datasheet view, you can add a subform (with its Default View property set to Datasheet) to the search form. However, that approach will require you to apply the filter to the subform rather than the main form.
如果您确实需要数据表,可以将其作为子表单嵌入到未绑定表单中,然后将汇总字段放在父表单的页脚中。这将保留用户利用数据表功能的能力(与 Allen Browne 示例中的连续形式相反)。
If you really need a datasheet, you could embed it as a subform in an unbound form, and then put summary fields in the footer of the parent form. This would preserve the user's ability to take advantage of the features of datasheets (as opposed to the continuous form in the example from Allen Browne).