VBA访问:从另一个表单的代码刷新表单 [英] VBA access: Refreshing a form from another form's code

查看:83
本文介绍了VBA访问:从另一个表单的代码刷新表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没关系,有人帮了我. form_(name).recalc或form_(name).refresh: form_main.recalc

nevermind someone helped me. form_(name).recalc or form_(name).refresh: form_main.recalc

我有两种形式:主要",细节". 在主"窗体中,我有一个在对话框中打开详细信息"的按钮. 问题是我有一个详细信息"复选框,当进行更改时, 我需要刷新主要". 这是什么命令? 谢谢

I have two forms: "main", "details". In the "main" form, I have a button that opens "details" in a dialog. The problem is that I have a checkbox in "details" and when in changes, I need to refresh "main". What command do that? Thank you

推荐答案

我将提供与您自己发现的答案不同的答案:

I'm going to provide a different answer than the one you discovered for yourself:

使用acDialog开关打开详细信息表单,然后在关闭时重新查询.打开详细信息表单的事件将如下所示(它将在主表单中):

Open the detail form with the acDialog switch, and then requery when it is closed. The event that opens the detail form would look like this (it would be in the main form):

  DoCmd.OpenForm "DetailForm", , , "ID=" & Me!ID, , acDialog 
  Me.Requery

这是在打开详细信息表单的情况下暂停代码.当您关闭详细信息表单时,它将重新查询主表单.

What this does is pause the code with the detail form open. When you close the detail form, it will requery the main form.

在我看来,这是做这种事情的标准方法.

This is the standard way of doing this kind of thing, seems to me.

这篇关于VBA访问:从另一个表单的代码刷新表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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