Need Practical Easy Example Of Passing Data Between Forms
Need Practical Easy Example Of Passing Data Between Forms
(OP)
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
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
RE: Need Practical Easy Example Of Passing Data Between Forms
----------
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