方案变动形成不会救 [英] Programmatic changes to form won't save

查看:260
本文介绍了方案变动形成不会救的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人有一个想法可能prevent的这些命令与实际储蓄的一种形式?是否有我失踪,可以使形式设置只读?我切换负载窗体上的control.enabled属性,但我没有看到使它坚持一旦我关闭的形式。

Does anyone have an idea what could prevent either of these commands from actually saving a form? Is there a setting I'm missing that could make the form "read-only"? I'm toggling the control.enabled property on the form on load, but I can't seen to make it stick once I've closed the form.

DoCmd.Close acForm, Me.Name, acSaveYes
DoCmd.Save acForm, Me.Name

编辑: 有些伪code澄清。 此功能运行在窗体加载启用/禁用某些控制和工程100%,符合市场预期。

Some psuedo code to clarify. This function runs on form load to enable/disable certain controls and works 100% as expected.

Private Sub Form_Load()
     If IsNull(TempVars.Item(Me.Name)) Then
         TempVars.Add Me.Name,1

         If somecondition = true then
             Me.Controls.Item("somecontrol").enabled = True
         Else
             Me.Controls.Item("somecontrol").enabled = False
         End If
     End If
End Sub

这个click事件关闭窗体,并打开另一种形式。问题是,在control.enabled设置我的窗体加载设置不保存。

This click event closes the form and opens another form. The problem is, the control.enabled settings I set on form load do not save.

Private Sub button_OnClick()
    DoCmd.OpenForm "someotherform", acnormal
    DoCmd.Close acForm, Me.Name, acSaveYes
End Sub

下一次我打开第一个表单,控件属性不会设置,我需要重新设置conrol.enabled属性。

The next time I open the first form, the control properties will not be set, and I need to set the conrol.enabled property again.

推荐答案

我一直没能找到任何文件,但现在看来,你不能保存在普通模式下所做的设计变更。最后我声明一个全局集合类型变量。我保存串联字符串在公约的这个集合变量Form.Name和放大器; Control.Name。如果表单从来没有被打开了,我跑了很长支票上的控制应该被启用,并将其存储在此集合全球。如果窗体已经打开至少一次,我通过控制形式检查,看看他们在我的全球授权控件集合的循环。那感觉真是的hackish,但它的工作原理pretty的好。

I've not been able to find any documentation, but it appears that you can not save design changes that are made in Normal mode. I ended up declaring a global collection type variable. I stored concatenated strings in this collection variable of the convention "Form.Name & Control.Name". If the form had never been opened, I ran the long check on which controls should be enabled, and stored them in this collection global. If the form had been opened at least once, I looped through the controls on the form checking to see if they were in my global collection of "authorized" controls. It feels really hackish, but it works pretty well.

这篇关于方案变动形成不会救的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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