Form and Subform

G

Guest

Hello,

I have a District Main Form that has the following fields and directly from
a table:

District ID (are an IDs that identifies the district)
P_Community ID (is a unique IDs that identifies the primary community ID in
the district)
P_Community (is the primary community name in the district)

I also have a District Subform that has the following information that is
linked to the main form by the P_Community:

P_Community (Primary Community)
S_Community (Secondary Communities), which is a drop down list
Store Location
Store Address
etc.

My problem is that the S_Community is a list of all the communities and I
want to only list the ones that are under whatever the specified District ID
that is being entered in the main form.

Thanks.
 
G

Guest

Add to the recordsource of the District Subform a filter with reference to
the main form
Select * From S_Community Where District ID = Forms![MainFormName]![District
ID]
On the after update event of the District ID in the main form run the code
me.SubName.requery
===========================================
Or
Link the Main form and the SubForm using the child and parent properties of
the sub form, using the District ID Field
No need to refresh the sub form after update
===========================================
 
G

Guest

Ofer,

I used your suggestion for adding to the record source and it work, but now
I have another problem. When I click on any of the S_Communuties in the
list, the P_Community is the only community that populates the field.

I'm really new to access, I'm sorry to keep bugging you.

Thanks

Ofer said:
Add to the recordsource of the District Subform a filter with reference to
the main form
Select * From S_Community Where District ID = Forms![MainFormName]![District
ID]
On the after update event of the District ID in the main form run the code
me.SubName.requery
===========================================
Or
Link the Main form and the SubForm using the child and parent properties of
the sub form, using the District ID Field
No need to refresh the sub form after update
===========================================

Trini Gal said:
Hello,

I have a District Main Form that has the following fields and directly from
a table:

District ID (are an IDs that identifies the district)
P_Community ID (is a unique IDs that identifies the primary community ID in
the district)
P_Community (is the primary community name in the district)

I also have a District Subform that has the following information that is
linked to the main form by the P_Community:

P_Community (Primary Community)
S_Community (Secondary Communities), which is a drop down list
Store Location
Store Address
etc.

My problem is that the S_Community is a list of all the communities and I
want to only list the ones that are under whatever the specified District ID
that is being entered in the main form.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top