473,756 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reference a Text Box from another Form displayed on a Tab Control

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 :)

Nov 13 '05 #1
14 4728
<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


Nov 13 '05 #2
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

Nov 13 '05 #3
<si************ @gmail.com> wrote in message
news:11******** ************@g4 7g2000cwa.googl egroups.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.Recordset Clone
.MoveFirst
While Not .EOF
MsgBox Nz(.Fields("Cou rse"))
.MoveNext
Wend
End With
Nov 13 '05 #4
Thats pretty darn cool! Thanks

So if i want to add all this textbox stuff then id do something like..

sAddedtext = sAddedtext & "&Body=" & Nz(.Fields("Cou rse"))

But that only adds the last box. i need it to contatenate it or
something?

Cheers in advance.

Nov 13 '05 #5
<si************ @gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Thats pretty darn cool! Thanks

So if i want to add all this textbox stuff then id do something like..

sAddedtext = sAddedtext & "&Body=" & Nz(.Fields("Cou rse"))

But that only adds the last box. i need it to contatenate it or
something?

Cheers in advance.

You're still using the loop, right? So I guess you're building up some form
of course list (for the body of an e-mail? guessing by the body). Anyway, I
don't understand [[...only adds the last box...]] unless you have removed
the loop. Don't you need something like:

Dim strList As String

With Me.trainingplan .Form.Recordset Clone
.MoveFirst
While Not .EOF
strList = strList & "<BR>" & Nz(.fields("Cou rse"))
.MoveNext
Wend
End With

Debug.Print strList
Nov 13 '05 #6
Thats the ticket!

Thanks for that!

I may post back here for more help on the matter if it arises. Thanks
for your time!!

You are much more with it than the other Brian Wilson of Beach Boys
fame!

Cheers again!

Nov 13 '05 #7
Ok this is what i've got..
Dim strList As String
With Me.trainingplan .Form.Recordset Clone
.MoveFirst
While Not .EOF
strList = strList & Chr$(13) & Nz(.Fields("Cou rse"))
.MoveNext
Wend
End With
sAddedtext = sAddedtext & "&Body=" & strList

Debug.Print strList
MsgBox sAddedtext
The <BR> didnt work. Chr$(13) works to get a carrige return in the
message box but when this is added to the email body i just get one
long line of text- i've got Outlook set to text only.

Eventually I want to have a table of rows & colmns displayed in the
body of the text.

Sorry for being so dumb. Just getting started with all this.

Cheers

Nov 13 '05 #8

<si************ @gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Ok this is what i've got..
Dim strList As String
With Me.trainingplan .Form.Recordset Clone
.MoveFirst
While Not .EOF
strList = strList & Chr$(13) & Nz(.Fields("Cou rse"))
.MoveNext
Wend
End With
sAddedtext = sAddedtext & "&Body=" & strList

Debug.Print strList
MsgBox sAddedtext
The <BR> didnt work. Chr$(13) works to get a carrige return in the
message box but when this is added to the email body i just get one
long line of text- i've got Outlook set to text only.

Eventually I want to have a table of rows & colmns displayed in the
body of the text.

Sorry for being so dumb. Just getting started with all this.

Cheers

It's not dumb to ask - that's what the group is here for. Anyway, some of
us prefer answering questions here than getting on with our real projects!
Try the built-in vbCrLf which is a carriage return and line-feed character -
the same as Chr$(13) & Chr$(10) I think. Of course, rows and columns can be
more nicely formatted if you have an html body, but I understand why you
might want to produce a text-only body.

Nov 13 '05 #9
<si************ @gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Ok this is what i've got..
Dim strList As String
With Me.trainingplan .Form.Recordset Clone
.MoveFirst
While Not .EOF
strList = strList & Chr$(13) & Nz(.Fields("Cou rse"))
.MoveNext
Wend
End With
sAddedtext = sAddedtext & "&Body=" & strList

Debug.Print strList
MsgBox sAddedtext
The <BR> didnt work. Chr$(13) works to get a carrige return in the
message box but when this is added to the email body i just get one
long line of text- i've got Outlook set to text only.

Eventually I want to have a table of rows & colmns displayed in the
body of the text.

Sorry for being so dumb. Just getting started with all this.

Cheers

<possible re-post>

It's not dumb to ask - that's what the group is here for. Anyway, some of
us prefer answering questions here than getting on with our real projects!
Try the built-in vbCrLf which is a carriage return and line-feed character -
the same as Chr$(13) & Chr$(10) I think. Of course, rows and columns can be
more nicely formatted if you have an html body, but I understand why you
might want to produce a text-only body.

Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
7463
by: dixie | last post by:
I have a text field on a form which has names with a comma between them like this: 'J. Smith, A. Jones, A. Man, J. Johns'. I am trying to find a procedure that will count the number of people in this text box and put the number into another text box (4 in the case above). If I could count the number of commas + 1, this would do it. Can anyone please help me with a way to achieve this? dixie
8
18392
by: Lyn | last post by:
Hi, Can anyone tell me how the initial value displayed in Combo Box is determined when a form is opened? I am loading the dropdown from one field ("CategoryName") of a table, with "ORDER BY ". The values in the dropdown are loaded in the correct order, but the initial value is not the first row of the dropdown as I expected. The field "CategoryName" is not the primary key for the table -- the PK is
4
3228
by: Omar Llanos | last post by:
Recently, I posted a question on how to invoke a textbox control in Form1 (parent form) from within Form2 (which is inherited from Form1). Someone suggested to pass a reference of the Form1 to the Form2 through the constructor of the Form2. He said that then I'd be able to invoke the textbox control in Form1 (with code in Form2). Since I'm pretty new with OOP, how would I be able to do that? I tried it but I kept getting the error that I...
2
2216
by: Jeff | last post by:
I'm getting an Object Reference error before I even run my app, and I'm not sure where to look to find the cause. I'd appreciate your help. When I open my Windows Application project, the following Microsoft Development Environment error message displays: "Object reference not set to an instance of an object." Then when I access the design view of one of my forms, the controls on
3
2440
by: Adriano | last post by:
Hello, when I try to print something, either DataGrid or from Crystal Report viever the folowing error message appears and cancels printing: Object reference not set to an instance of an object :(((( Anyone pls help me to solve this problem!!! thanks in advance,
8
1882
by: wASP | last post by:
Hi, I'm having a problem referencing the elements within an object after a method of that object (a member function) has been activated with an onsubmit handler: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <script language="javascript" type="text/javascript"> function js_onsubmit_hndl_fn () {
4
2674
by: CrimeMaster | last post by:
HI I have an Exe file when it runs ,there are just two controls on the window.One is a ListBox and another is a Multi line Rich Edit control.When i click on an item in the list some text is displayed in the Edit control.Exe have a Hunderds of items in the List controls,which display some text in edit control against an item selection. I want to read that data which is displayed in edit control against the selection of an item in list...
1
8369
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an instance of an object.'" I've traced the problem to a custom control I created that inherits from Inherits System.Windows.Forms.TextBox. In this custom control, I have two constructors. I'm not sure why I created the second constructor -- it was so...
11
5188
by: jwessner | last post by:
I have a form (Form1) which contains basic Project data and a subform listing the personnel assigned to the Project as a continuous form. Selecting a person on that project and clicking on a command button will open a new form (Form2). Form2 has two subforms. Both are embedded in the main form. (Subform2 is NOT embedded in subform1.) Subform1 displays records as a continuous form based on the Primary ID of the main form and lists the...
0
9455
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10031
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9869
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9708
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2665
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.