简体   繁体   English

表单和子表单

[英]Form and subform

How can I set a subform to open in data entry mode when opened by pressing button 1 from another form and open the same subform in view mode when pressed button 2. Right now not only the subform but the main form also goes into data entry mode.如何设置子表单在通过另一个表单中的按钮 1 打开时以数据输入模式打开,并在按下按钮 2 时在视图模式下打开相同的子表单。现在不仅子表单而且主表单也进入数据输入模式. So how can I make the subform to change based on the buttons pressed.那么如何让子表单根据按下的按钮进行更改。

One way to accomplish is to use OpenArgs.实现的一种方法是使用 OpenArgs。

Code in Button1. Button1 中的代码。

DoCmd.OpenForm "YourMainFormName",,,,,,"Button1"

Code in Button2. Button2 中的代码。

DoCmd.OpenForm "YourMainFormName",,,,,,"Button2"

Code in main form Load event.主窗体加载事件中的代码。

Me.YourSubformContainerName.Form.DataEntry = IIf(Me.OpenArgs = "Button1", True, False)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM