Solved Listbox and SubForm (1 Viewer)

ProgramRasta

Member
Local time
Today, 09:10
Joined
Feb 27, 2020
Messages
98
Hi All

I have a parent Form with two subforms.

SubForm1 is a listbox and is unbound. Subform2 is bound to the parent form.

What I want to do is click on the listbox and it filters subform2 by column(0) which is the same in both subforms.

Any suggestions/tips/good programming etiquette are most welcome.

Many Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:10
Joined
Oct 29, 2018
Messages
21,357
Hi. Quick question first. Why is your Listbox in a subform? Why can't you just put it on the main form? Just curious...
 

ProgramRasta

Member
Local time
Today, 09:10
Joined
Feb 27, 2020
Messages
98
Hi. Quick question first. Why is your Listbox in a subform? Why can't you just put it on the main form? Just curious...

Thanks DBGuy for the response.

Basically the Subform contains "summary statistics". The source of the listbox is a query with a group by on it and it contains roughly 15 rows.

Subform2 contains the data behind these "statistics" and may contain 1000 rows.

What I want to do in the most efficient way possible is to click on the listbox in subform1 and display the data behind these "statistics".

appreciate your patience.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:10
Joined
May 21, 2018
Messages
8,463
Any chance you could post the DB?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:10
Joined
Oct 29, 2018
Messages
21,357
Thanks DBGuy for the response.

Basically the Subform contains "summary statistics". The source of the listbox is a query with a group by on it and it contains roughly 15 rows.

Subform2 contains the data behind these "statistics" and may contain 1000 rows.

What I want to do in the most efficient way possible is to click on the listbox in subform1 and display the data behind these "statistics".

appreciate your patience.
Hi. All I am saying is if you place the Listbox on the main form, filtering the other subform would be a little easier. Unless, you are not calling a datasheet subform as a Listbox, are you?
 

ProgramRasta

Member
Local time
Today, 09:10
Joined
Feb 27, 2020
Messages
98
Hi All,

Its arguably not the most aesthetically pleasing database you have ever seen but hopefully it conveys the purpose I am aiming for.

the parent form will have text boxes that are bound to "SampleData".

I want to be able to click on the listbox and filter SampleData

thanks
 

Attachments

  • SampleListBox.accdb
    600 KB · Views: 222

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:10
Joined
May 21, 2018
Messages
8,463
Update
 

Attachments

  • MajP_SampleListBox.accdb
    600 KB · Views: 181

ProgramRasta

Member
Local time
Today, 09:10
Joined
Feb 27, 2020
Messages
98
Thanks Majp, works as intended. Appreciate your time with this.

I have a follow on question if I may. Is there any way you can have the same functionality without doing the query with the group by on it? I’m wondering if it would be possible just to have the record source on the main form feed through to the other forms?

thanks again
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:10
Joined
May 21, 2018
Messages
8,463
I am sorry I do not understand the question; however, I am sure it can be done. Can you provide more detail?
I’m wondering if it would be possible just to have the record source on the main form feed through to the other forms?
This kind of sounds like a split form concept. Where the main form is in single form view and the subform is in continous form view. Where the details of the subform selected record are displayed in the main form.
 

ProgramRasta

Member
Local time
Today, 09:10
Joined
Feb 27, 2020
Messages
98
I am sorry I do not understand the question; however, I am sure it can be done. Can you provide more detail?

This kind of sounds like a split form concept. Where the main form is in single form view and the subform is in continous form view. Where the details of the subform selected record are displayed in the main form.
Majp, thanks for the response.

my question is could I achieve the same functionality with using just one query on the main form?

so in essence summarise the data in the list box (currently a group by query) and filter on specific records in the continuous form (currently a separate query).

I am just wondering if the approach I have taken is the optimal approach.

appreciate your expertise on the matter.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:10
Joined
May 21, 2018
Messages
8,463
See if this is what you mean. You can do it this way, you just do not have as much real estate. You could change the listbox into a combobox instead to give you more room.
 

Attachments

  • MajP_SampleListBox.accdb
    472 KB · Views: 223

Users who are viewing this thread

Top Bottom