对docmd.openform感到困惑 [英] Confused about docmd.openform

查看:116
本文介绍了对docmd.openform感到困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

formA确定some_where和some_value并发布


docmd.close,我

docmd.openform" formB",,some_where ,,, some_value


formB收到正确的some_where和some_value

完成工作后的表格B问题


docmd.close,Me

docmd.openform" formA"


formA确定一个新的some_where和some_value并再次发布


docmd .close,我

docmd.openform" formB",,some_where ,,, some_value


formB收到正确的some_where但没有更新some_value


我还注意到表单''OnOpen事件代码只执行表单打开的第一个

时间。我如何在第一次之后将新的OpenArgs值传递给

formB?


我对我在哪里放置密切陈述持怀疑态度,但

这两个订单对我来说都没有意义:如果我先关闭表单,那么封闭表单如何执行关闭后的open语句

声明? ...但是如果我先打开下一个表单,那么我是不是离开了存在close语句的

环境?如果我打开

语句失败,那么为什么* open *语句的* part *

正确执行[some_where]?


--thelma

改写一个未回答的问题

解决方案

我这里只有几位。


我建议docmd.close acform,me.Name(你只有我和我明确

地址Name属性;我添加了acform是确保)


关闭事件发生在卸载之前。这意味着结束表格可以

仍然执行代码。无论如何,只要事件运行,代码仍然执行,我就不记得那里的中断了。


我怀疑当你打开表格时来自表单B,表单A打开表单

B,代码执行在OpenForm到达之前尚未结束,因此表单B

从未留下内存。但这只是一个猜测。


我最近才尝试传递一个新的OpenArgs(因为被调用的表格

当然会对它做一些事情)和失败。所以,我在表单中创建了一个公共的

子(默认情况下表单中的例程是私有的),这些设置确实是
。我可以从自己的Open事件中调用它,但是

调用者也可以调用它。


所以而不是


docmd.openform theform,openargs:= some_value


你可以写


docmd.openform theform

表格!theform.Sync some_value


你有的表单模块


Public Sub Sync(theValue as Whatever)

''你的代码

结束子

Thelma Lubkin写道:

formA确定一个新的some_where和some_value并再次发布

docmd.close,我
docmd.openform" formB",,some_where ,,, some_value

formB收到正确的some_where但没有更新some_value formB?

我很怀疑我在哪里发表了密切的陈述,但是
都没有订购对我有意义:如果我首先关闭表单,那么封闭表单如何执行关闭
语句之后的open语句? ...但是如果我先打开下一个表单,那么我是不是离开了存在close语句的
环境?如果我的公开声明失败了,那么为什么*开放式声明的*部分正确执行[some_where]?

- 告诫
未回答的问题




-

Bas Cost Budde,荷兰
http://www.heuveltop.nl/BasCB/msac_index.html




Thelma Lubkin写道:


我很怀疑我在哪里发表了密切的陈述,但是这两个命令对我来说都没有意义:如果我先关闭表单,那么关闭的表单如何执行关闭
语句之后的open语句? ...但是如果我先打开下一个表单,那么我是不是离开了存在close语句的
环境?如果我的开放语句失败,那么为什么* open *语句的* part *正确执行[some_where]?




关闭表格第二,所有问题都解决了。

代码执行被中断通过开头表格的'OnLoad

和OnOpen活动,但返回发出

公开声明的程序。


至于为什么部分公开声明有效,谁知道除非

你显示实际代码而不是大纲。如果您引用

表格,您刚刚关闭它会引发错误。


rkc< rk * @ rochester。 yabba.dabba.do.rr.bomb>写道:


:Thelma Lubkin写道:

:>

:>我怀疑我在哪里发表了密切的陈述,但是

:>这两个命令对我都没有意义:如果我先关闭表单,那么

:>封闭形式执行收盘后的开放式声明

:>声明? ...但如果我先打开下一个表格,我就不会离开

:>存在close语句的环境?如果我打开

:>陈述失败,那么为什么* *是开放陈述的* * *
:>正确执行[some_where]?


:关闭表格,解决所有问题。

:代码执行被中断通过开头表格''OnLoad

:和OnOpen活动,但返回发出

:open声明的程序。


:至于为什么部分公开声明有效,谁知道除非

:你显示实际代码而不是大纲。如果您正在引用

:您刚刚关闭它的表单应该抛出错误。


我尝试了这种方式而OpenArgs仍未更新。此外,

这个打开,关闭的顺序产生不稳定的行为:它经常

没有响应点击返回按钮[一个切换开关]

形式B,但并非总是如此。我无法做足够的测试

来获取好的和坏的回报模式。


感谢您的尝试。


--thelma


blockquote>

formA determines some_where and some_value and issues

docmd.close ,Me
docmd.openform "formB", , ,some_where, , ,some_value

formB receives the correct some_where and some_value
After completing its work formB issues

docmd.close ,Me
docmd.openform "formA"

formA determines a new some_where and some_value and again issues

docmd.close ,Me
docmd.openform "formB", , ,some_where, , ,some_value

formB receives the correct some_where but no update of some_value

I also note that the forms'' OnOpen event-code executes only the first
time that the forms are opened. How do I pass a new OpenArgs value to
formB after the first time?

I''m suspicious about where I''ve placed the close statements, but
neither order makes sense to me: if I close the form first, how does
the closed form execute the open statement that comes after the close
statement? ...but if I open the next form first, haven''t I left the
environment where the close statement exists? And if my open
statements are failing, then why is *part* of the open statement
executing correctly [the some_where]?

--thelma
rephrasing an unanswered question

解决方案

I have only a few bits here.

I suggest docmd.close acform, me.Name (you have just Me and I explicitly
address the Name property; I added the acform to be sure)

The Close event happens before Unload. That means the closing form can
still execute code. Anyway, as long as the events run, the code still
executes, I can''t recall interruption there.

I suspect that when you open form A from form B, and form A opens form
B, code execution has not ended before OpenForm is reached, so form B
has never left memory. But that is just a guess.

I only recently tried to pass a new OpenArgs (because the called form
does something with it, of course) and failed. So, I created a public
sub in the form (routines in a form are private by default) that does
the settings. I can then call this from its own Open event, but the
caller can also call it.

So instead of

docmd.openform theform, openargs:= some_value

you can write

docmd.openform theform
forms!theform.Sync some_value

inside the form module you have

Public Sub Sync(theValue as Whatever)
'' your code
End Sub
Thelma Lubkin wrote:

formA determines a new some_where and some_value and again issues

docmd.close ,Me
docmd.openform "formB", , ,some_where, , ,some_value

formB receives the correct some_where but no update of some_value

I also note that the forms'' OnOpen event-code executes only the first
time that the forms are opened. How do I pass a new OpenArgs value to
formB after the first time?

I''m suspicious about where I''ve placed the close statements, but
neither order makes sense to me: if I close the form first, how does
the closed form execute the open statement that comes after the close
statement? ...but if I open the next form first, haven''t I left the
environment where the close statement exists? And if my open
statements are failing, then why is *part* of the open statement
executing correctly [the some_where]?

--thelma
rephrasing an unanswered question



--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html



Thelma Lubkin wrote:


I''m suspicious about where I''ve placed the close statements, but
neither order makes sense to me: if I close the form first, how does
the closed form execute the open statement that comes after the close
statement? ...but if I open the next form first, haven''t I left the
environment where the close statement exists? And if my open
statements are failing, then why is *part* of the open statement
executing correctly [the some_where]?



Close the form second and all your problems are solved.
Code execution is "interrupted" by the opening form''s OnLoad
and OnOpen events, but returns to the procedure that issued the
open statement.

As for why part of the open statement is working, who knows unless
you show the actual code instead of an outline. If you are referencing
the form you just closed it should throw an error.


rkc <rk*@rochester.yabba.dabba.do.rr.bomb> wrote:

: Thelma Lubkin wrote:
:>
:> I''m suspicious about where I''ve placed the close statements, but
:> neither order makes sense to me: if I close the form first, how does
:> the closed form execute the open statement that comes after the close
:> statement? ...but if I open the next form first, haven''t I left the
:> environment where the close statement exists? And if my open
:> statements are failing, then why is *part* of the open statement
:> executing correctly [the some_where]?

: Close the form second and all your problems are solved.
: Code execution is "interrupted" by the opening form''s OnLoad
: and OnOpen events, but returns to the procedure that issued the
: open statement.

: As for why part of the open statement is working, who knows unless
: you show the actual code instead of an outline. If you are referencing
: the form you just closed it should throw an error.

I tried it that way and OpenArgs are still not updating. Also,
this order of open, close produces erratic behavior: it often
doesn''t respond to clicking the Return button [a toggle switch]
in formB, but not always. I wasn''t able to do enough testing
to pick up the pattern of good and bad returns.

Thanks for trying.

--thelma



这篇关于对docmd.openform感到困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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