AllExperts > Using MS Access 
Search      
Using MS Access
Volunteer
Answers to thousands of questions
 Home · More Using MS Access Questions · Answer Library  · Encyclopedia ·
More Using MS Access Answers
Question Library

Ask a question about Using MS Access
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Rob Henderson
Expertise
I can answer most MS Access design questions. I also welcome questions on database design and implementation and VBA programming questions. I also have expierence in application design for all the Office components (Excel, Outlook, etc).

 
   

You are here:  Experts > Computing/Technology > Business Software > Using MS Access > Relating forms in VBA

Using MS Access - Relating forms in VBA


Expert: Rob Henderson - 2/23/2005

Question
My knowledge of VBA is very basic.

This is the situation:
I've got a form (A) with specifications for a building project, with a subform (B) which gives a list of buildings belonging to this project. In Subform B I want to create a link to a new form C in which I can define types of rooms belonging to a building listed in subform B.

When I press the link/button to open form C for defining a NEW building, then form C most take the data from form A. So it opens a new form (C) which  gives the name of the project where the building belongs to.

I think this problem most be solved by directly using VBA. I hope my problem is clear, and every solution is welcome.

Answer
Hi

The easiest answer here is...

When opening form C, reference the fields you wish to use on form A

I.e.

Me.txtSomeField = Forms!frmFormA!txtSomeField

What's happening above is the value from Form A, txtSomeField is then inherited by form C, txtSomeField

You could use similar syntax in the Form_Open event of form C

HTH

rob

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.