Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating Name on Subform

Status
Not open for further replies.

bdm1

Programmer
Feb 4, 2002
75
0
0
US
I have a CONTACT form which I enter the family information ie. Father's info and mother's info. A command button takes you to a PARTICIPANT form to enter the children from that family who are enrolling in a program/activities. These 2 forms are linked with the CONTACTID field. The PARTICIPANT form has a DETAILSUBFORM linked by the PARTICIPANTID field. In the event that the participant is the mother of father, I would like to create a command button which will look up the first name and last name on the CONTACT form and update the DETAILSUBFORM so the info does not need to be entered twice. I created a macro to do this,and it works fine as far as updating the father's info. But I need an "if than else statement" (I think). In other words, if there is no information on the CONTACT form for the father, then fill in the first and last name field with the mother's info. I have tried every which way, but the syntax is a problem. Any help will certainly earn you wings!!!
 
...........................................................
assumptions :

When at the participant form the Contact form is still open and that is where you want to get the father-mother info from!

If no Father surname is present the field will be null as opossed to " "

I have not included any checking in case the mother fields are also null
...........................................................

on the Participant detailed subform add a button with on click event :

if not isnull ([forms]![frmContact]![Fathers_Surname]) then
me![Contact_Surname] = [forms]![frmContact]![Fathers_Surname]
me![Contact_Firstname] = [forms]![frmContact]![Fathers_firstname]

else
me![Contact_Surname] = [forms]![frmContact]![Mothers_Surname]
me![Contact_Firstname] = [forms]![Contact]![Fathers_firstname]

end if
end sub
............................................................

hope this does it for you
 
Thanks much....works like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top