问题描述
我在编辑一个很久以前由其他人创建的旧数据库时遇到了一些麻烦。
那里是一个表单,让用户选择一个工作人员,并显示他们已经有的培训的详细信息。
我试图添加到这是什么是一个电子邮件按钮,通过电子邮件发送选定的
人 - 我已经设法能够抓住电子邮件和
用相应的电子邮件地址创建一封新电子邮件。
我现在要做的是放在
文本框中存储的电子邮件详细信息的正文中。
我在引用这些文本框时遇到问题,因为它们存储在
另一个表单上,该表单使用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>
我认为,这个子表单绑定到一个有字段的数据源
命名为课程 - 这就是我们要看的。显示此信息的文本框名称
控件无关紧要。在这里我们可以使用
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 :)
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
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
这篇关于引用选项卡控件上显示的另一个表单中的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!