Beginner - Trouble assigning text to Form Label Caption

D

duBedat68

Hi,
I am doing an assignment which requires two forms of user input.
The first form asks for "Parent's" information & when validated, loads the
second form which asks for "Child's" information.
The Child form is supposed to display the Parent details in its labels, but
I can't seem to find a way to do it.
I have tried a heap of different ways, but nothing seems to work.
Here is the offending bit of code:
************************************
************************************
Private Sub frmChild_Initialize()
With frmChild.lblChildShowParentDetails
.Caption = _
frmParent.txtParentFirstName.Value & " " _
& frmParent.txtParentSurname.Text
.Visible = True
frmChild.lblChildShowAddressDetails.Caption = _
frmParent.txtParentStreetAddress.Value & " " _
& frmParent.txtParentSuburb.Value & " " _
& frmParent.txtParentPostCode.Value

If frmParent.optParentYes.Value = True _
Then
frmChild.lblChildShowCentreLinkConfirm = "YES"
Else
lblChildShowCentreLinkConfirm = "NO"

End Sub
****************************************
****************************************
As you can see, I am trying a number of different ways to achieve the
desired outcome, but can't seem to get it to work.

Any help is greatly appreciated
Thanks
duBe
 
D

duBedat68

Sorry everyone,
after taking a coffee break, I took another look at the offending code &
realised that instead of using the default "UserForm_Initialize", I
apparently used my own secret (ha ha) "frmChild_Initialize" proceedure.

Therefore the only way it was going to do what I wanted it to do was to make
a call to the proceedure.

I fixed it up as follows & it works fine now,

****************************************
****************************************

Private Sub UserForm_Initialize()

frmChild.lblChildShowParentDetails.Caption = _
frmParent.txtParentFirstName.Text & " " _
& frmParent.txtParentSurname.Text

frmChild.lblChildShowAddressDetails.Caption = _
frmParent.txtParentStreetAddress.Value & " " _
& frmParent.txtParentSuburb.Value & " " _
& frmParent.txtParentPostCode.Value

If frmParent.optParentYes.Value = True _
Then
frmChild.lblChildShowCentreLinkConfirm = "YES"
Else
lblChildShowCentreLinkConfirm = "NO"
End If

End Sub

*****************************************
*****************************************

Sorry again
duBe
 
J

John Vinson

I am doing an assignment which requires two forms of user input.
The first form asks for "Parent's" information & when validated, loads the
second form which asks for "Child's" information.
The Child form is supposed to display the Parent details in its labels, but
I can't seem to find a way to do it.

You're doing this a VERY hard way; I wonder if you're coming from a
Visual Basic background!

If you simply make the Child form a Subform of the Parent form, you'll
automatically maintain the link and be able to see the data from both
forms concurrently.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
D

duBedat68

Thanks John,
In all honesty, I'm coming from no background at all.

Truth is, I'm doing an course in MS Office at a Technical College & the
Assignments require me to do a fair bit of VBA coding.

This might be OK for most people, but the text books they recommend & the
instruction given at the College, don't give you any idea about how to go
about the tasks required.

As I'm a beginner, I am finding it difficult to understand a lot of what is
required, so I am mostly making it up as I go, by looking around these forums
for snippets of code.

I have a vague idea how to do "Sub-reports" in Access, but I have no idea
how to make "Sub-forms" in Excel.

If it helps you to understand my problem, the assignment is for a fictional
Child Care Centre.
They require 2 forms to load automatically as follows:

1. "Parent Info" form that asks for all the parent's details
2. Parent Info form imput is validated, & if so
3. "Child Info" form loads & asks for all the child's details
4. "Child Info" form is to display all the "Parent Info" form details in
labels

How I have achieved this is by putting in a call to load the "Child Info"
form from within the "Parent Info" form after all info is validated.

***********************************
***********************************
Private Sub cmdParentNext_Click()
frmParent.Hide
Load frmChild
frmChild.Show

End Sub
***********************************
***********************************

I would be grateful if you were able to show me a better way to achieve this.

Many kind regards
duBe
 
D

duBedat68

WOW,
I just realised that I posted this question to the WRONG forum.

I am doing an EXCEL project, not an Access one.

I really am sorry about that.

Kind regards
duBe
 
J

John Vinson

WOW,
I just realised that I posted this question to the WRONG forum.

I am doing an EXCEL project, not an Access one.

I really am sorry about that.

No problem! The benighted Microsoft Help system just plops all Office
users into the same stack of newsgroups, and it seems that many people
just assume that "access" in the newsgroup name has something to do
with "access to help". Yes, I was assuming you were in Access not
Excel; I'm sure if you scroll down and find an appropriate Excel
newsgroup that the gurus there can help. (or... this really sounds
like a pretty good Access project...!)

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top