如何按顺序调用多个表单?

huangapple go评论63阅读模式
英文:

How do I call multiple forms sequentially?

问题

我有数据输入分为多个表单,我想按顺序调用它们。

我启动第一个表单,然后使用附加到按钮的宏,打开下一个表单并关闭并保存第一个表单,继续进行。

是否可以创建一个表单集合并使用For Each迭代它们?

Sub FrmEntry()
    Dim Frms as New Collection
    Frms.Add(Forms![FormName])
End Sub

在此点处进行调试会导致运行时错误2450。

英文:

I have data entry broken down into multiple forms that I would like to call sequentially.

I start the first form, and then with a macro attached to a button, open the next form and close and save the first, continuing on.

Is it possible to create a collection of forms and iterate through them with For Each?

Sub FrmEntry()
    Dim Frms as New Collection
    Frms.Add(Forms![FormName])
End Sub

Debugging at this point causes a Runtime error 2450.

答案1

得分: 0

以下是您要翻译的内容:

实际上,您不需要关闭先前的表单。

此外,假设您正在查看一家公司的记录。

然后,您点击一个按钮以创建发票。为什么不直接启动发票表单呢?然后,当用户关闭表单时,下面(后面)的表单现在将显示出来,然后您就可以回到公司表单(准备为该公司创建另一张发票)。

而且,如果您关闭公司表单,那么您就会回到“搜索公司”的表单。

从用户的角度来看?他们都使用浏览器,而且您甚至可以添加一个返回箭头按钮。对用户来说,他们认为“返回一个”,但实际上您所做的只是关闭表单。

当您关闭表单时,先前的表单现在就在视野中。

在“旧日”里,我们习惯于启动一个表单,也许移动它,然后也许再启动另一个表单,然后再移动它。

然而,这所谓的“多文档界面”现在已经几乎消失了。

事实证明,Access在2007年(16年前!!!)推出了一个新的选项卡式布局选项。

这是对基于Web的软件的响应,现在也包括平板电脑等。在这个新的“UI时代”中,我们不再只考虑表单,而只想要返回(或选择一个选项以前进)。

事实证明,您可以在主要设置中设置Access使用选项卡,然后关闭选项卡。实际上,所有表单都占满了整个屏幕。

所以,您最终会得到这种外观:

如何按顺序调用多个表单?

请非常注意我多次点击“返回”箭头。

我所做的一切只是关闭当前表单,然后返回到以前的表单。但这只需要我关闭当前表单,然后显示以前显示的表单即可。

正如我所指出的,这很重要,因为您不仅想打开以前的表单,还想显示您正在处理的以前的数据。

正如您所看到的,上面的操作几乎只需要我

打开表单---在上面显示一个新表单。

Docmd.OpenForm “表单名称”;

关闭当前表单 - 返回到以前的表单。

docmd.Close acForm, me.Name

我的意思是,打开QuickBooks,或Sage会计,或者现在的几乎任何Windows软件?

您会看到他们采用了这种类型的UI。

或者您可以在MS Access中使用/执行此选项:

如何按顺序调用多个表单?

上面是另一种常见的设置。您在侧边(或顶部)有一组按钮,那就是您的应用程序导航。

这在网站上很常见(顶部的选项卡)或侧边。

您可以在此处看到我的示例视频:

https://www.youtube.com/watch?v=AU4mH0jPntI

现在,公平地说,确实有一些弹出式表单。

虽然那个示例是Access的“基于Web的”,不幸的是,该选项已从Access中删除,但UI可以相同。

因此,总结一下:

是的,隐藏以前的表单是一个很好的主意。
不,如果您采用覆盖以前表单的表单,您不需要编写太多代码来管理该过程。

或者,您可以按照第二个示例中的做法使用新的导航表单。

所以,尽管您的想法很好,但我认为您实际上不需要或不想担心“您”管理此表单的打开,因为存在一大堆问题,而一个简单的问题是当您想返回到以前的页面(返回)时,您不仅需要重新加载该表单,还需要以某种方式管理正在显示的数据。

正如上面的示例所示,如果您设计您的软件UI“流程”以充分利用Access现在具有的较新UI选项,您就不必这样做。

这样做将导致一个“外观和感觉”,与今天大多数软件一样,无论是基于Web还是桌面版的Access。

英文:

Actually, you don't really need to close the previous form.

Besides, say you looking at a company record.

Then you click a button say to create a invoice. Why not just launch the invoice form. Then when the user closes the form, the form below (behind) will now show, and you right back to the company form (ready to create another invoice for that company).

And say you close the company form, then you right back to the "search for a company" form.

From a users point of view? They all use browsers, and you can/could EVEN have a back arrow button. To the user, they think "go back one", but what you really are doing is simply closing the form.

When you close the form, the previous one is now in view.

While in the "old" days, we were "used" to launching a form, maybe move it around, and then perhaps launch another form, and move it around.

However this so called "multiple document interface" has quite much gone the way of the do do bird.

Turns out, Access in 2007 (16 years ago!!!) received a NEW tabbed layout option.

This was in response to web based software, and now tablets etc. In this new "era of UI" then we don't really think of in terms of a form, but only that we want to go back (or choose a option, to go forward).

Turns out, you can set Access (in main settings), to use tabs, and then turn off tabs. In effect then, all forms take up the whole screen.

So, you wind up with this look:

如何按顺序调用多个表单?

Note VERY close how a few time I hit that "back" arrow.

All I am doing is closing the current form, and then going back to previous form. But, that ONLY requires that I close the current form, and then the previous form that was displayed comes back into view.

As I noted, this is important, since you would not "only" want to open the previous form, but display the previous data that you were working on.

As you can see, the above takes little more then JUST me

Openform --- display a new form on top.

Docmd.OpenForm "form name"

close current form - returns to previous form.

docmd.Close acForm, me.Name

I mean, open up QuickBooks, or Sage accounting, or just about ANY windows software these days?

You see that they adopted this type of UI.

Or you can use/do this option in ms-access:

如何按顺序调用多个表单?

The above is another common setup. You have a set of buttons on the side (or top), and that's your application navagation.

This is common in web sites (tabs accross the top), or the side.

You can see a video of that example of mine here:

https://www.youtube.com/watch?v=AU4mH0jPntI

Now, to be fair, there ARE a number of popup forms.

And while that sample was Access "web based", unfortunately that option was removed from Access, but the UI can be identical.

So, in summary:

YES, a very good idea to hide the previous form.
NO, you don't have to write much code to manage that process if you adopt forms that cover the previous form.

Or, you can as per that 2nd example, use a new navigation form.

so, while your ideas are good, I don't think you actually need to, or want to worry about "you" managing this form being opened, since there is a BOATLOAD of issues, and one simple issue is when you want to go back to the previous page (back), then you have to not only re-load that form, but also somehow manage what data was being displayed.

As the above examples show, you don't have to do this, if you design your software UI "flow" to take advantage of the newer UI options we now have in Access.

Doing so, will result in a "look and feel" that most software has today, be it web based, or Access desktop based.

huangapple
  • 本文由 发表于 2023年5月14日 08:38:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76245386.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定