Applying a Filter on a Subform

  • Thread starter Thread starter Oli
  • Start date Start date
O

Oli

Hi

I have my main form (frm_Contacts) and then a subform (sfrm_calls) which is
displayed as a continuous form.

sfrm_calls is supposed to display details of any calls made to, or received
from the client. It sort of works..... except instead of showing just calls
for the current client it is showing the entire contents of the table (i.e.
all calls in the database).

The table sfrm_calls relates to (tbl_calls) i has the following information:

callid (autonumber) (primary key)
ContactID
etc......

When a call is added it is successfully appending the correct ContactID to
the table.

So, basically how do I get my subform (sfrm_calls) to filter for the current
ContactID and not display the entire contents?

TIA
Oli
 
Oli said:
Hi

I have my main form (frm_Contacts) and then a subform (sfrm_calls)
which is displayed as a continuous form.

sfrm_calls is supposed to display details of any calls made to, or
received from the client. It sort of works..... except instead of
showing just calls for the current client it is showing the entire
contents of the table (i.e. all calls in the database).

The table sfrm_calls relates to (tbl_calls) i has the following
information:

callid (autonumber) (primary key)
ContactID
etc......

When a call is added it is successfully appending the correct
ContactID to the table.

So, basically how do I get my subform (sfrm_calls) to filter for the
current ContactID and not display the entire contents?

TIA
Oli

The settings in the two properties MasterLink and ChildLink of the subform
control should automaticaly provide two things for you...

Propogation of the parent linking field data to any new children records
created

Filtering the subform so it only shows records that are related to the
record in the parent.

I am puzzled as to how you can be successfully getting the first of these
behaviors without getting the second. At any rate I would double check
those property settings.
 
Use the LinkMasterFields and LinkChildFields property of the subform control
to link the main form and the subform so that the subform displays data
based on the relationship to the main form. Based on what you've posted,
likely that is the ContactID, so put ContactID in both of these properties
for the subform control.
 
Hi Ken

I do not see these options in properties (i.e. when i right click the
subform and choose properties)

Am i looking in the right place?

TIA
Oli
 
Oli said:
Hi Ken

I do not see these options in properties (i.e. when i right click the
subform and choose properties)

Am i looking in the right place?

On the { Data } tab of the property sheet when the subform *control* has
focus. If you click twice you will be seeing properties for the form within
the subform control and the properties won't be listed.
 
Back
Top