Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / October 2005

Tip: Looking for answers? Try searching our database.

relating tables - carrying over record ID to new form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken Cobler - 12 Oct 2005 01:19 GMT
I have two tables, one with the key "Building ID".  The second table has the
key "Image ID" plus I also added the field Building ID to it in order to
relate the two tables in a one-to-many relationship.

My form for Table 1 has a button which opens the form for the second table.  
I have the field "Building ID" on both forms.  However, instead of the second
form displaying the Building ID which matches the first table, it shows a
zero.  What is the best way to force the Building ID number of the second
table/form to match the Building ID number of the first form?

Thanks!
John Vinson - 12 Oct 2005 06:52 GMT
>My form for Table 1 has a button which opens the form for the second table.  
>I have the field "Building ID" on both forms.  However, instead of the second
>form displaying the Building ID which matches the first table, it shows a
>zero.  What is the best way to force the Building ID number of the second
>table/form to match the Building ID number of the first form?

IMO the *best* way is to make the second form a Subform of the first,
using BuildingID as the Master and Child Link Field.

When you *open* a second form, you're opening it from scratch, with no
automatic reference to the calling form. If you really want to use two
separate, independent forms, you'll need to put VBA code in the event
which opens the second form, setting its WhereCondition argument to

"[BuildingID] = " & Me![BuildingID]

and probably also passing BuildingID in the OpenArgs parameter, and
using VBA code in the second form's Open event to set the Default
Value property of the BuildingID to the passed value.

If that sounds complicated, it is; if the subform sounds easy... it is
too!

                 John W. Vinson[MVP]    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.