如何在对话框窗体上输入数据后刷新子窗体 [英] How to get the subform to refresh after entering data on a dialog form

查看:440
本文介绍了如何在对话框窗体上输入数据后刷新子窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Access 2013

我有一个子表单,它是主报表的一部分。我希望用户看到他们将使用对话框表单输入的条目(应该与此子表单连接)。子表单在数据表视图中,因为有许多与报表关联的合规性。

我尝试在AfterUpdate中使用DoCmd.Requery以及表单加载。


不太了解VBA代码,但是有人告诉我这是一行,但是我等了好几周这一行。


怎么能在提交对话框条目后,我得到了更新的数据表吗?

Working with Access 2013
I have a subform that is part of the main report form. I want users to see entries which they would enter using the dialog form (that should be connected with this subform). The subform is in Datasheet view since there are many ''Compliance'' associated with the report.
I tried using a DoCmd.Requery in the AfterUpdate and also the form load.

Don''t know much of VBA code but someone told me it''s one line, yet I am waiting weeks for this one line.

How can I get the datasheet to update after the dialog entry was submitted?

推荐答案

devlearner

对于发布你的代码最有帮助,所以我们可以确切地看到发生了什么 - 一定要使用 [CODE /] 格式化选项......


如果从子表单中调用对话框表单's代码,AND,对话框是模态。然后最简单的方法就是在调用对话框后立即使用 Me.Rquery


所以你的代码可能会看起来像

devlearner
would be most helpful to post your code so we can see exactly what is happening - be sure to use the [CODE/] formatting option...

If you are calling the dialog form from within the Subform''s code, AND, the dialog is "Modal" then the easiest method is on the line immediately following the call to your dialog is to use Me.Rquery

So your code might look like

展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号


你好zmbd


我不知道有表格的任何VBA代码。

对于主窗体中的子窗体,存在一个制表符控件,该子窗体驻留在其中一个页面上。

此子表单是数据表视图,并假设反映在对话框表单中输入的数据。使用带宏控制的按钮打开对话框窗体。这对我来说很容易,因为老实说,我不知道VBA代码。我的支持告诉我它是一个简单的代码行,但究竟是什么代码将使用对话框表单中输入的数据刷新/重新查询子表单(数据表)视图?


/>
这是我被困的地方。甚至没有意识到所有这些事情都需要代码。我过去习惯于宏。


我尝试了Me.Requery,这是我在网上找到的第一个代码,同时寻找我想要实现的目标的明确答案。


如果您需要更多信息,请告诉我。与此同时,我不知道如何让这个数据表像后端(主表)一样更新。

Hi zmbd

I do not have any VBA code for the forms.
For the subform inside the main form, there exists a tab control and this subform resides on one of the pages.
This subform is datasheet view and suppose to reflect data entered on the dialog form. The dialog form is opened using a button with macro control. This was easy for me because I honestly don''t know VBA code. My sup told me its a simple line of code but what exactly is that code that will refresh/requery the subform (datasheet) view with the data entered in the dialog form?



This is where I am stuck. Didn''t even realize that code was necessary for all these things. I was so accustomed to macros in the past.

I have tried the Me.Requery which was the first bit of code I found online while searching for a definite answer to what I am trying to achieve.

If you need any more information, please do let me know. In the meantime, I don''t know how to get this datasheet to update like the backend (master table).

附加图像
(69.3 KB,495 views)
subform2.jpg ( 59.7 KB,489 views)
Attached Images
(69.3 KB, 495 views)
subform2.jpg (59.7 KB, 489 views)


devlearner,


我的第一个建议是从Macros转向VBA。


宏可以转换为VBA(在设计视图中打开表单,在设计选项卡下的工具组,选择工具组,选择将表单的宏转换为Visual Basic。


这将帮助您入门。你会发现1)切换到VBA并不像大多数人想象的那么困难(为什么MS Access默认使用宏远远超出任何开发人员的理解)2)VBA是如此灵活和强大,你会想知道为什么你之前从未使用过它。


我会试着仔细看看你到目前为止所拥有的东西。 Z在这里也是一位非常有价值的专家。你想要做的事情听起来并不是很困难 - 我们只需要找到细节,你就应该好好去!
devlearner,

My first advice is to move away from Macros and toward VBA.

Macros can be converted to VBA (open the Form in Design View, under Form Design Tools, in the Design Tab, Tools Group, select "Convert Form''s Macros to Visual Basic".

This will get you started. You will find 1) the switch to VBA is not really as difficult as most people think (why MS Access defaults to macros is far beyond the comprehension of any developer) and 2) VBA is so much more flexible and powerful, you will wonder why you never used it before.

I will try to take a closer look at what you have so far. Z is also a very valuable expert here. What you are trying to do does not sound very difficult--we just need to find the details and you should be good to go!


这篇关于如何在对话框窗体上输入数据后刷新子窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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