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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Practical Easy Example Of Passing Data Between Forms 2

Status
Not open for further replies.

BTurner0606

Programmer
Dec 21, 2000
4
US
I am new to Access programming and I am sure this is not very difficult, but I am having trouble understanding how to implement it. I need help with the coding needed on the Openform for form_Family and needed coding for form_Visit.

I am up against a deadline and any help would be greatly appreciated.

I have the following scenario:

tbl_Family
FamilyID Integer
MemberNumber Integer
FirstName Text
LastName Text
BirthDate Date
---------------------------------------
tbl_Visit_Data
FamilyID Integer
MemberNumber Integer
VisitDate Date
Address Text
Telephone Text
---------------------------------------
form_Family
TextBox FamilyID
TextBox MemberNumber
TextBox FirstName
TextBox LastName
TextBox Birthdate
CommandButton "Visit Info"
---------------------------------------
form_Visit
TextBox FamilyID
TextBox MemberNumber
TextBox FirstName
TextBox LastName
TextBox BirthDate
TextBox VisitDate
TextBox Address
TextBox Telephone
---------------------------------------

When I click the CommandButton on form_Family, I want to pass the FamilyID and MemberNumber to form_Visit. Then I want FirstName, LastName and BirthDate to be automatically populated with data from the tbl_Family. I will enter VisitDate, Address and Telephone to complete the data entry.


Bently Turner
bturner@wi.rr.com
 
Make a Module and have several variables that are Global
Public PubFamilyID As integer
Public PubMemberNum As integer
Then in the on_Click subroutine of the form you are coming from
Set these global variables to the values that you want to move `


Walt III
SAElukewl@netscape.net
 
You might want to also look into the possibility of using a subform and linking the forms on the family ID. I think you have a lot of repetitive data being stored that should only need to be stored once and linked to other tables via primary and foreign keys......

that's my two cents, but Walt is exactly right as far as creating variables for use in any form.
Mike Rohde
rohdem@marshallengines.com
 
You might have already tried this..but I think all you are really needing to do is pass the values from one from to the other. You've got 2 forms. A 'source' form (form_family)and then the 'destination form' (form_visit)

In your destination fields you need to refere to the values in the source fields.
Do this by making a reference for thecontrol source of the text box you want to populate,(this is found in the properties for each of the text boxes) in this case you want to populate FamilyID in the Form called Form_Visit
For the control source Use-->

!Forms![Form_Family]![FamilyID]

For the next text box, MemberNumber use
!Forms![Form_Family]![MemberNumber]
do the same for the other text boxes
!Forms![Form_Family]![FirstName]
!Forms![Form_Family]![LastName]
!Forms![Form_Family]![BirthDate]

when you open the destination form...you will see that the source values have been populated with whatever values the source form currently is holding.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top