×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Need Practical Easy Example Of Passing Data Between Forms

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

RE: Need Practical Easy Example Of Passing Data Between Forms

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close