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 1

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
 
On the OnClick event of the command button put the following:

----------
DoCmd.OpenForm "form_Visit", acNormal, , , acFormAdd
----------

Now in the OnOpen event of form_Visit, put the following:

----------
With Forms!form_Family
Me.FamilyID = !FamilyID
Me.MemberNumber = !MemberNumber
Me.FirstName = !FirstName
Me.LastName = !LastName
Me.Birthdate = !Birthdate
End With

Me.VisitDate.Setfocus
----------

Do not close form_family while you are working with form_Visit, or Access will give you an error. Jim Lunde
compugeeks@hotmail.com
Custom Application Development
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top