引用选项卡控件上显示的另一个表单中的文本框 [英] Reference a Text Box from another Form displayed on a Tab Control

查看:66
本文介绍了引用选项卡控件上显示的另一个表单中的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编辑一个很久以前由其他人创建的旧数据库时遇到了一些麻烦。


那里是一个表单,让用户选择一个工作人员,并显示他们已经有的培训的详细信息。


我试图添加到这是什么是一个电子邮件按钮,通过电子邮件发送选定的

人 - 我已经设法能够抓住电子邮件和

用相应的电子邮件地址创建一封新电子邮件。


我现在要做的是放在

文本框中存储的电子邮件详细信息的正文中。


我在引用这些文本框时遇到问题,因为它们存储在

另一个表单上,该表单使用Tab Control显示在此表单上。


我想从中获取详细信息的选项卡称为tabTraining.This从名为trainingPlan的表单获取其

数据。并且有各种文本框。


如何引用这些框以将存储在其中的文本添加到名为sAddedtext的

变量中。


是否类似于sAddedtext = tabTraining.trainingPlan.textbox.text


不确定我是否在合适的位置。


请帮忙:)

解决方案

< si *********** *@gmail.com>在消息中写道

news:11 ******************** @ g47g2000cwa.googlegrou ps.com ...


有一个表单可以让用户选择一个工作人员和展示
有关他们所接受的培训的详细信息。

我试图添加到这个是一个电子邮件按钮,通过电子邮件发送选定的人 - 我已经设法能够抓住电子邮件并使用相应的电子邮件地址创建新的电子邮件消息。

我现在想要做的是放在存储的电子邮件详细信息的正文中
文本框。

我在引用这些文本框时遇到问题,因为它们存储在另一个表单上,该表单使用Tab Control显示在此表单上。

我想从中获取详细信息的标签名为tabTraining.This从名为trainingPlan的表单中获取其数据。并且有各种文本框。

如何引用这些框以将存储在其中的文本添加到名为sAddedtext的变量中。

是否类似sAddedtext = tabTraining.trainingPlan.textbox.text

不确定我是否在合适的位置。

请帮助:)



是否在选项卡控件上放置任何特定控件实际上与你引用它的方式没有什么区别。

所以即使txtBox1在表单的一部分上和txtBox2在选项卡

控件上,它们将以完全相同的方式引用:

Value1 = Me.txtBox1

Value2 = Me .txtBox2


这部分可能很麻烦:

[[...因为它们存储在此表格上显示的另一个表格上

使用Tab Control ....]]

听起来你正在使用子表单。虽然你可能设计了两种形式,但是复杂性是即使

:Form1(用作主窗体)和

Form2(用作子窗体),一次Form2被放置在Form1上它被使用

作为子窗体*控件*并且控件的名称应该显示这个。例如,控件的
名称将是sbfMySub,即使它的SourceObject(它使用的

实际表单)是Form1。

当引用时你会写这些文本框:

Forms!Form1.sbfMySub.Form.txtSomeTextBox

或者,从Form1中

Me.sbfMySub.Form。 txtSomeTextBox


blockquote>

谢谢你我用过了


Me.trainingplan.Form .Course


这样可以获得一个文本框的信息,但表格是一个

连续表格。所以我需要能够从同名的所有

文本框中提取文本。这可能吗?


对不起所有问题。我是新手。


干杯


< si ********* ***@gmail.com>在消息中写道

news:11 ******************** @ g47g2000cwa.googlegrou ps.com ...

谢谢,我已经用过了

Me.trainingplan.Form.Course

这样可以获得一个文本框的信息,但表格是
连续表格。所以我需要能够从所有相同名称的文本框中提取文本。这可能吗?

对不起所有的问题。我是新手。

干杯



我认为,这个子表单绑定到一个有字段的数据源

命名为课程 - 这就是我们要看的。显示此信息的文本框名称

控件无关紧要。在这里我们可以使用

RecordsetClone遍历子表单上的所有记录:


使用Me.trainingplan.Form.RecordsetClone

.MoveFirst

而不是.EOF

MsgBox Nz(.Fields(" Course))

.MoveNext

Wend

结束


Hi, I''m having a bit of trouble editing an old database that was
created quite a while ago by someone else.

There is a form that lets the user select a member of staff and show
details about the training they have had.

What im trying to add to this is an email button which emails the
person selected - i''ve managed to be able to do grab the email and
create a new email message with the coresponding email adress.

What i want to do now is put in the body of the email details stored in
text boxes.

I''m having trouble referencing these text boxes as they are stored on
another form which is displayed on this form using a Tab Control.

The tab I want to grab details from is called tabTraining.This gets its
data from form called trainingPlan. And there are various text boxes.

How do i reference these boxes to add the text stored in them to a
variable called sAddedtext.

Is it something like sAddedtext = tabTraining.trainingPlan.textbox.text

Not sure if i''m on the right lines.

Please help :)

解决方案

<si************@gmail.com> wrote in message
news:11********************@g47g2000cwa.googlegrou ps.com...

Hi, I''m having a bit of trouble editing an old database that was
created quite a while ago by someone else.

There is a form that lets the user select a member of staff and show
details about the training they have had.

What im trying to add to this is an email button which emails the
person selected - i''ve managed to be able to do grab the email and
create a new email message with the coresponding email adress.

What i want to do now is put in the body of the email details stored in
text boxes.

I''m having trouble referencing these text boxes as they are stored on
another form which is displayed on this form using a Tab Control.

The tab I want to grab details from is called tabTraining.This gets its
data from form called trainingPlan. And there are various text boxes.

How do i reference these boxes to add the text stored in them to a
variable called sAddedtext.

Is it something like sAddedtext = tabTraining.trainingPlan.textbox.text

Not sure if i''m on the right lines.

Please help :)


Whether any particular control is placed on a tab control actually makes no
difference to how you reference it.
So even if txtBox1 was on one part of the form and txtBox2 was on the tab
control, they would be referenced in exactly the same way:
Value1=Me.txtBox1
Value2=Me.txtBox2

This is the part which may be troublesome:
[[...as they are stored on another form which is displayed on this form
using a Tab Control....]]
It sounds like you are using a subform. Here, the complexity is that even
though you may have designed two forms: Form1 (used as the main form) and
Form2 (used as the subform), once Form2 is placed on Form1 it is being used
as a subform *control* and the name of the control should show this. Eg the
name of the control would be sbfMySub even though its SourceObject (the
actual form it uses) is Form1.
When referering to these textboxes you would write:
Forms!Form1.sbfMySub.Form.txtSomeTextBox
or, from within Form1
Me.sbfMySub.Form.txtSomeTextBox



Hi thanks for that I''ve used

Me.trainingplan.Form.Course

This works fine to get the info for one text box however the form is a
Continuous Form. So i need to be able to extract the text from all the
textboxes of the same name. Is this possible?

Sorry for all the questions . Im a newbie to this.

Cheers


<si************@gmail.com> wrote in message
news:11********************@g47g2000cwa.googlegrou ps.com...

Hi thanks for that I''ve used

Me.trainingplan.Form.Course

This works fine to get the info for one text box however the form is a
Continuous Form. So i need to be able to extract the text from all the
textboxes of the same name. Is this possible?

Sorry for all the questions . Im a newbie to this.

Cheers


I asssume, then, this subform is bound to a datasource that has a field
named "Course" - and this is what we''ll look at. The name of the textbox
control which displays this information is not relevant. Here we can use
the RecordsetClone to loop through all the records on the subform:

With Me.trainingplan.Form.RecordsetClone
.MoveFirst
While Not .EOF
MsgBox Nz(.Fields("Course"))
.MoveNext
Wend
End With


这篇关于引用选项卡控件上显示的另一个表单中的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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