访问VBA:表单按钮点击设置记录源 [英] Access VBA: Set record source of form on button click

查看:454
本文介绍了访问VBA:表单按钮点击设置记录源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种形式的查看报告按钮,单击该按钮时,我想的另一种形式的记录源更改为其他并刷新呢?

I have a "View Report" button in one form and when the button is clicked I want to change the record source of another form to something else and refresh it?

我试图把这个code。在按钮的点击功能,但它不工作

I tried to put this code in the click function of the button but its not working

    access.forms("Form1").RecordSource = {bla bla}

但它不工作。错误说,它可以找到Form1中。

but its not working. The error says it can find Form1..

任何帮助是AP preciated!
谢谢!

Any help is appreciated!
Thank you!

推荐答案

Access.Forms 集合的打开的形式集合只。如果你想设置的另一种形式的记录源,您必须确保其他的形式是开放的第一位。

The Access.Forms collection is a collection of the open forms only. If you want to set the RecordSource of another form, you must ensure the other form is open first.

如果你愿意,你可以打开其他格式为隐藏,设置记录源,然后将窗体的Visible属性设置为True。

If you want, you can open the other form as Hidden, set the RecordSource, and then set the form's Visible property to True.

这篇关于访问VBA:表单按钮点击设置记录源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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