传递变量 - OpenArgs? [英] pass variable - OpenArgs?

查看:175
本文介绍了传递变量 - OpenArgs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


这里有一个极端新手所以希望这是一个简单的新手。


我有一个带三个按钮的总机。每个按钮都会打开相同的表格但我需要传递一个字符串,具体取决于按下哪个按钮。换句话说,交换机上的按钮A,按钮B和按钮C.按下按钮A,A将传递给Form1。按下按钮B,B将传递给Form1。按下按钮C和''C''传递给Form1。


我意识到我也可以使用单选按钮来做这个 - 比使用按钮更容易还是更好?我喜欢按钮,因为它们使用户非常明显需要做什么。


现在这里变得棘手了。在Form1上有一个带整数的字段。我不确定这个字段是自动编号还是由用户手动输入。


这个数字和按钮从交换机传递的字符串将被连接起来并存储在为Form1提供字段的表中。因此,如果用户按下按钮C,然后在Form1上,数字为3,则实际存储在表中的值为C3。


所以这就是我''我想我必须做,虽然我不知道进入它的代码。


1)使用OpenArgs从交换机上的每个按钮传递字符串(A,B或C)。将字符串存储在Form1可以访问的某个变量中。


2)在Form1上的文本框的AfterUpdate()属性中保存整数,将整数与字符串变量连接并插入它进了桌子。


这是对的吗?请随意提供建议,备选方案,以及最重要的,如何编写这个想法的地点和内容。


谢谢!

melissa

Hi there,

Extreme newbie here so hopefully this is an easy one.

I have a switchboard with three buttons. Each button will open the same form BUT I need to pass a string depending on which button is pressed. In other words, Button A, Button B, and Button C on the switchboard. Press Button A and ''A'' gets passed to Form1. Press Button B and ''B'' gets passed to Form1. Press Button C and ''C'' gets passed to Form1.

I realize I can use radio buttons to do this too - is that easier or better than using buttons? I like buttons because they make it very obvious to the user what the need to do.

Now here is where it gets tricky. On Form1 there is a field with an integer. I''m not sure yet whether this field will be an autonumber or will be manually entered by the user.

This number and the string passed by the button from the switchboard will be concatenated and stored in the table that supplies the fields for Form1. So if the user presses Button C and then on Form1 the number is 3 the value that is actually stored in the table is ''C3''.

So here is what I''m thinking I have to do, though I don''t know the code that goes into it.

1) use OpenArgs to pass the string (''A'', ''B'', or ''C'') from each button on the switchboard. Store the string in a variable somewhere that Form1 can access.

2) In the AfterUpdate() property of the textbox on Form1 that holds the integer concatenate the integer with the string variable and insert it into the table.

Is this about right? Please feel free to offer suggestions, alternatives, and most important, the how where and what of coding this idea.

thanks!
melissa

推荐答案


你好,


极端新手在这里所以希望这是一个简单的新手。


我有一个带三个按钮的总机。每个按钮都会打开相同的表格但我需要传递一个字符串,具体取决于按下哪个按钮。换句话说,交换机上的按钮A,按钮B和按钮C.按下按钮A,A将传递给Form1。按下按钮B,B将传递给Form1。按下按钮C和''C''传递给Form1。


我意识到我也可以使用单选按钮来做这个 - 比使用按钮更容易还是更好?我喜欢按钮,因为它们使用户非常明显需要做什么。


现在这里变得棘手了。在Form1上有一个带整数的字段。我不确定这个字段是自动编号还是由用户手动输入。


这个数字和按钮从交换机传递的字符串将被连接起来并存储在为Form1提供字段的表中。因此,如果用户按下按钮C,然后在Form1上,数字为3,则实际存储在表中的值为C3。


所以这就是我''我想我必须做,虽然我不知道进入它的代码。


1)使用OpenArgs从交换机上的每个按钮传递字符串(A,B或C)。将字符串存储在Form1可以访问的某个变量中。


2)在Form1上的文本框的AfterUpdate()属性中保存整数,将整数与字符串变量连接并插入它进了桌子。


这是对的吗?请随时提供建议,替代方案,以及最重要的,如何编写这个想法的地点和内容。


谢谢!

melissa
Hi there,

Extreme newbie here so hopefully this is an easy one.

I have a switchboard with three buttons. Each button will open the same form BUT I need to pass a string depending on which button is pressed. In other words, Button A, Button B, and Button C on the switchboard. Press Button A and ''A'' gets passed to Form1. Press Button B and ''B'' gets passed to Form1. Press Button C and ''C'' gets passed to Form1.

I realize I can use radio buttons to do this too - is that easier or better than using buttons? I like buttons because they make it very obvious to the user what the need to do.

Now here is where it gets tricky. On Form1 there is a field with an integer. I''m not sure yet whether this field will be an autonumber or will be manually entered by the user.

This number and the string passed by the button from the switchboard will be concatenated and stored in the table that supplies the fields for Form1. So if the user presses Button C and then on Form1 the number is 3 the value that is actually stored in the table is ''C3''.

So here is what I''m thinking I have to do, though I don''t know the code that goes into it.

1) use OpenArgs to pass the string (''A'', ''B'', or ''C'') from each button on the switchboard. Store the string in a variable somewhere that Form1 can access.

2) In the AfterUpdate() property of the textbox on Form1 that holds the integer concatenate the integer with the string variable and insert it into the table.

Is this about right? Please feel free to offer suggestions, alternatives, and most important, the how where and what of coding this idea.

thanks!
melissa



是的,这似乎是正确的。只是一些事情。


1)OpenArgs是一个变量,它在窗体打开时由窗体创建,因此它已经存储在Form1可以访问的位置:Me .OpenArgs


2)你可以使用&运营商。您可以将字段绑定到表单上的控件,并让Access自动更新表,这样您就不必经历编程更新的麻烦。


如果你卡在任何地方,请告诉我们。

Yep, this seems about right. Just a few things though.

1) The OpenArgs is a variable that is created by the form when it opens so it''s already stored in a place that Form1 can access: Me.OpenArgs

2) You can concatenate using the & operator. You can just have the field bound to a control on the form and let Access auto-update the tables so you don''t have to go through the trouble of programming an update.

Let us know if you get stuck anywhere.



是的,这似乎是对的。只是一些事情。


1)OpenArgs是一个变量,它在窗体打开时由窗体创建,因此它已经存储在Form1可以访问的位置:Me .OpenArgs


2)你可以使用&运营商。您可以将字段绑定到表单上的控件,并让Access自动更新表,这样您就不必经历编程更新的麻烦。


如果你卡在任何地方,请告诉我们。
Yep, this seems about right. Just a few things though.

1) The OpenArgs is a variable that is created by the form when it opens so it''s already stored in a place that Form1 can access: Me.OpenArgs

2) You can concatenate using the & operator. You can just have the field bound to a control on the form and let Access auto-update the tables so you don''t have to go through the trouble of programming an update.

Let us know if you get stuck anywhere.



哇,我很喜欢这个论坛上的快速回复!


1)好的我将需要一些帮助编码。当我在交换机上创建一个按钮并告诉它打开Form1(在这种情况下称为fr​​m_Survey)时,Access会创建此代码:

Wow sweet, I LOVE the quick replies on this forum!

1) Okay I''m going to need some help with the coding. When I create a button on the switchboard and tell it to open Form1 (which is called frm_Survey in this case) then Access creates this code:

展开 | 选择 | 换行 | 行号



哇,我很喜欢这个论坛上的快速回复!


1)好的,我要走了需要一些编码方面的帮助。当我在交换机上创建一个按钮并告诉它打开Form1(在这种情况下称为fr​​m_Survey)时,Access会创建此代码:
Wow sweet, I LOVE the quick replies on this forum!

1) Okay I''m going to need some help with the coding. When I create a button on the switchboard and tell it to open Form1 (which is called frm_Survey in this case) then Access creates this code:
展开 | 选择 | 换行 | 行号


这篇关于传递变量 - OpenArgs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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