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 / March 2008

Tip: Looking for answers? Try searching our database.

linking subforms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
fredloh@gmail.com - 06 Mar 2008 13:51 GMT
my application have customers and invoices.  each customer can have 1
or more invoices. on my form i have a subform for customers and one
subform for invoices. both subforms are in datasheet view. if i click
on customer A in the customer subform i want the invoice subform to
show only invoices for customer A and at the same time allow me to add
invoices for customer A. what are the steps to accomplish this?

also i want to be able to print a report such that customer A is
listed together with all customer A's invoices followed by customer B
and so on. how can this be accomplished?

thanks for your help.
Ron2006 - 06 Mar 2008 16:11 GMT
Assuming that the invoice table has contained in it a field that
contains the ID of the customer to wich the invoice belongs.

1) On the main form that contains both of these subforms, add a txtbox
(txtCustID) make it visible property False.
2) in the OnCurrent event of the subform that is showing the customers
add code
     forms![nameofmainform]!txtCustID = me.nameofcustomeridfield

3) Go to the second subform, and get the properties for the Form
itself and on the data tab you will see "Link Child Fields" and "Link
Master Fields"
      The wizard will NOT work because the main form is not linked to
a table/query so instead
      in the "Link Child Fields" type [nameoffieldthatcontainsid of
the customer master]
      in the "Link Master Fields" type txtCustID

The above steps will handle automatically refreshing when you change
records AND it will automatically load the customerid into the child
field when you create a new record. (You will have to be sure to have
"Allow Adds" set to yes on the child subform data tab.

Ron
 
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.