Subform Filter (1 Viewer)

Gismo

Registered User.
Local time
Today, 02:50
Joined
Jun 12, 2017
Messages
1,298
Hi all,

I have a form with 2 sub forms
the first subform gives a list of values which has already been filtered as required
the second subborm is a form i need to update so i dont want to link any other tables to the source
i tried to link master and child fields but it only gives a result of the first record from the first subform

am i looking at this from an incorrect point of view?
what should I do?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:50
Joined
Oct 29, 2018
Messages
21,467
Hi. Not sure I follow what you are saying. What happens if you remove the master/child linked fields?
 

Gismo

Registered User.
Local time
Today, 02:50
Joined
Jun 12, 2017
Messages
1,298
Hi. Not sure I follow what you are saying. What happens if you remove the master/child linked fields?
then all the records are displayed

sub form 1 has a few index records which must be the only records to be displayed in subform 2

if i link my query to sub form 2 then that form becomes un editable
so i tried using the parent /child link but only the first record in the first form is a result in the second sub form

sample: sub form 1 has group 2, 3 5 and 6
subform 2 should only display all the records with the groups 2, 3, 5 and 6

at this point in time, subform 2 only all records with group 2, which is the first record of subform 1, no other records from the other groups are displayed
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:50
Joined
Oct 29, 2018
Messages
21,467
Sounds like you want to use a filter then.
 

Gismo

Registered User.
Local time
Today, 02:50
Joined
Jun 12, 2017
Messages
1,298
You know, like using a criteria in your query?
i have my queries in each sub form but the first subform supplies the filter i require for the second subform
but i can not link the query to the second form because then it is not editable
 

Gismo

Registered User.
Local time
Today, 02:50
Joined
Jun 12, 2017
Messages
1,298
basically that i need to do is link multiple records in subform 1 to multiple records in subform 2

if subform has a value of 1 and 2 in a control, i need to see all records in subform 2 with values 1 and 2

both are continues forms
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:50
Joined
Oct 29, 2018
Messages
21,467
basically that i need to do is link multiple records in subform 1 to multiple records in subform 2

if subform has a value of 1 and 2 in a control, i need to see all records in subform 2 with values 1 and 2

both are continues forms
I would think you don't want to "link" the subforms but use a filter instead. Can you post a sample copy of your db? I can't tell you exactly what to do, if I have no idea what your db forms look like.
 

Gismo

Registered User.
Local time
Today, 02:50
Joined
Jun 12, 2017
Messages
1,298
maybe i am not understanding you filter suggestion
I have a query in my second subform to filter required records to be edited. i need to filter it further by the first subform which is not set, that is why i need to use my first subform which reads a different criteria depending on signon region
so i can not fix the criteria in the second forms query

subform 2 give me records which has not been completed yet. then gives you the option to edit the record
subform 1 looks at the signon then looks at the location then filters only registration relevant to the person signed in
i have tried a few ways, including using a table and master/child links but the problem is, the first sub form has multiple record which need to be reflected in the filter for the second subform
master/child only filters the first record in the first subform which will only show records in the second subform related to the first record from the first subform

it will be a many to many link
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 19:50
Joined
May 21, 2018
Messages
8,527
You need to give some real field names and describe how the records in subform 2 relate to the records in subform 1.

Sometimes on a very complex filter it may be very difficult to relate that WHERE conditions. So I loop the returned records and get all the primary keys. Assume in subform 1 you have records 1,11,32,44,56....99 . I will build the filter string WHERE SomeField in (1,,11,32,44,56....99).
So in this case the second subform can return all child records of 1,11,32,... without having to pass a very complicated critiera that returned these parent records.
 

Gismo

Registered User.
Local time
Today, 02:50
Joined
Jun 12, 2017
Messages
1,298
You need to give some real field names and describe how the records in subform 2 relate to the records in subform 1.

Sometimes on a very complex filter it may be very difficult to relate that WHERE conditions. So I loop the returned records and get all the primary keys. Assume in subform 1 you have records 1,11,32,44,56....99 . I will build the filter string WHERE SomeField in (1,,11,32,44,56....99).
So in this case the second subform can return all child records of 1,11,32,... without having to pass a very complicated critiera that returned these parent records.
i agree with you
my question is, how do i accomplish this?
i can not build the filter query into my subform 2 query because then it wont be editable
i can not use master/child because it only displays the first record
i am not very faliliar with the loop funtion

will it be easier to update my table with records from the first sub form then filter from there? this way i do not need 2 queries in my second sub form
then i can remove my first subform totally
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:50
Joined
Oct 29, 2018
Messages
21,467
because then it wont be editable
Why won't it be editable? We can't see your database, so it's a little hard to tell you how to fix it.
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 19:50
Joined
May 21, 2018
Messages
8,527
My response is just a wild guess. I use this technique where I have a dynamic form with lots of filter options. I cannot pass that filter to another form or query, because that form or query may not even have the same fields. However if the first filter returns X number of records I can have the second form simply filter to those X records or relate somehow to those X records.

Right now it is just a guess. Your post provides zero useable information. You are going to have to spend some effort if your really want some assistance.
 

shokly

New member
Local time
Yesterday, 16:50
Joined
Jan 13, 2021
Messages
7
do you need to display all the record information in subform1, if not so, why don't you use a combobox with row source of the records from query of subform1, and put this combo in the criteria of query for subform2, that way it will filter the records you need whenever you select them in the combobox.
 

Users who are viewing this thread

Top Bottom