<si************ @gmail.com> wrote in message
news:11******** ************@g4 7g2000cwa.googl egroups.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.Thi s 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.tra iningPlan.textb ox.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.txtBo x1
Value2=Me.txtBo x2
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.sbf MySub.Form.txtS omeTextBox
or, from within Form1
Me.sbfMySub.For m.txtSomeTextBo x