Senin, 11 Juli 2011

Re: [MS_AccessPros] Synchronizing a Form and Sub-Form (Access 2003 or 7)

 

Terry

The Main form must have the Primary key in its query. The sub form must have the foreign key to the main form's query.

In other words, if the main form has a CustomerID as the primary key the sub form must also have the CustomerID for the relationship. The sub has to be able to link to the right record in the main.

Can you post the SQL for both queries here?

Bill

--- In MS_Access_Professionals@yahoogroups.com, "Terry Olsen" <terryomsn@...> wrote:
>
> Thanks, Bill.
> I gave your suggestion a shot and looked at the sub-form's properties. Both the master and child properties were null. However, when trying to pull down values in either of the two properties, I received a "cannot build a link between unbound forms."
> I'm wondering if Access is trying to tell me that query-based forms can't participate in the Master-Child linkage?
> Terryomsn
>
> --- In MS_Access_Professionals@yahoogroups.com, "Bill Mosca" <wrmosca@> wrote:
> >
> > Terry
> >
> >
> >
> > Just to jump out there without doing too much effort <grin>...
> >
> > Have you made sure you sub form is linked to your main form?
> >
> > 1. Open the main form in design view.
> >
> > 2. Click on the sub form control and make sure the master and child links
> > are set up properly.
> >
> >
> >
> > Regards,
> >
> > Bill Mosca,
> >
> > Founder, MS_Access_Professionals
> >
> > That'll do IT <http://www.thatlldoit.com/> http://thatlldoit.com
> >
> > MS Access MVP
> >
> > <http://mvp.support.microsoft.com/profile/Bill.Mosca>
> > http://mvp.support.microsoft.com/profile/Bill.Mosca
> >
> >
> >
> >
> >
> > From: MS_Access_Professionals@yahoogroups.com
> > [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Terry Olsen
> > Sent: Thursday, July 07, 2011 6:22 PM
> > To: MS_Access_Professionals@yahoogroups.com
> > Subject: [MS_AccessPros] Synchronizing a Form and Sub-Form (Access 2003 or 7)
> >
> >
> >
> >
> >
> > I apologize in advance for the length of this message. I've been trying to get
> > it work for a bit.
> >
> > Functionality Needed
> > I need a form that will give me the ability to select a RunID; the form should
> > have a sub-form that displays selected columns for all table2 records with
> > TripID that also have a table1.RunID equal to the selected (from the combo on
> > the form) RunID.
> >
> > Current Status
> > I have the form working.
> > I have the sub-form working.
> > Currently, the form and sub-form are operating independently. I can select the
> > RunID. The sub-form is displaying all records as there are no criteria being
> > passed to the sub-form.
> > What I don't know how to do is synchronize the sub-form query results for the
> > combo box selected RunID from the form.
> > I've found all Table 1 TripIDs with the same RunID by creating a query using the
> > Query Design tool, and joining Table 2 to Table 1 by TripId and using a
> > hard-coded RunID as a query criterion.
> >
> > Background Info
> > Table 1 (tblCurrentRunsWithTripsFromXMLTransform)
> > RunID - Number data type
> > TripID - Number data type
> > Table2 (tblCurrentOrcaXMLTrip)
> > TripID - Number data type
> > TripName - Text data type
> > PeakFlag - Text data type
> > PeakFare - Text data type
> > Relationship
> > Each Table1.RunID will have one or more Table2.TripIDs (not defined in
> > Relationships).
> > Each Table2.TripIDs has only one Table1TripID (defined in Relationships)
> > The form contains only one Combo box that is populated by calling the
> > qryCurrentDistinctRunsFromXMLTransform query.
> > SELECT [qryCurrentDistinctRunsFromXMLTransform].[RunId] FROM
> > qryCurrentDistinctRunsFromXMLTransform ORDER BY [RunId];
> > The qryCurrentDistinctRunsFromXMLTransform query looks like this.
> > SELECT DISTINCT tblCurrentRunsWithTripsFromXMLTransform.RunId
> > FROM tblCurrentRunsWithTripsFromXMLTransform
> > ORDER BY tblCurrentRunsWithTripsFromXMLTransform.RunId;
> > The query that populates the sub-form is qryDisplayTripInfo
> > SELECT tblCurrentOrcaXMLTrip.TripId, tblCurrentOrcaXMLTrip.TripName,
> > tblCurrentOrcaXMLTrip.PeakFlag, tblCurrentOrcaXMLTrip.PeakFare
> > FROM tblCurrentOrcaXMLTrip;
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar