Listbox contents dependent on different controls (1 Viewer)

Tay

likes garlic
Local time
Today, 22:05
Joined
May 24, 2002
Messages
269
I've been asked to improve functionality on a form that someone else has designed. Currently, there is a multi-column listbox that can be filtered by two option buttons. Checking one button will display all records, checking the other will display the top 100 records for the user who has logged in. The columns are 'data source', 'data stream', 3 x dates and user name. The set up is an Access front end and SQL server backend. The data in the listbox columns comes from four different tables.

I need to allow users to also filter on two of the columns within the listbox. So, users ought to be able to choose by 'data source' and all/my top 100 records or choose by 'data stream' and all/my top 100 records. I'd envisioned doing this by leaving the option buttons in place but also using two combos, one for 'data source' and one for 'data stream'.

Is it possible to allow filtering of the listbox, bearing in mind the search criteria aren't straightforward? And if so, will my approach work, or do I need to rethink how to do this? I've not got it to work so far, but this may be my (not quite good enough yet) vba skills rather than a logical fail.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 22:05
Joined
Jul 9, 2003
Messages
16,360
Show the after update event of the option group.
 

Tay

likes garlic
Local time
Today, 22:05
Joined
May 24, 2002
Messages
269
The option buttons weren't set up as an option group. They each have on click events. The form's Load event also refers to these two option buttons.

Does it make a difference that they're not in an option group? I can't think that I've ever put an option group (or option buttons) on a form that I've designed, so my knowledge of them is limited.
 

jdraw

Super Moderator
Staff member
Local time
Today, 17:05
Joined
Jan 23, 2006
Messages
15,394
It might be easier for readers if you could post some relevant code, or a copy of the database.
 

Tay

likes garlic
Local time
Today, 22:05
Joined
May 24, 2002
Messages
269
I can't easily post a copy of the db, but I've attached the relevant portion of vba in the attached rtf. The form itself has a fair few other similar listboxes (and heaps more vba), but the one I'm interested in updating with cboDataSource is called RecentUploads.

I thought I'd try and get one of the two 'filter' combos working; I'll need another, the same as DataSource, but for DataStream.

Users ought to be able to choose either DataSource or DataStream to further refine by alongside the existing option buttons for all records or my uploads (records) only.
 

Attachments

  • Enhance_vba1.txt
    4.4 KB · Views: 60

jdraw

Super Moderator
Staff member
Local time
Today, 17:05
Joined
Jan 23, 2006
Messages
15,394
I'm not following the code you sent.
Can you not set the rowsource of cboDataSource to be RecentUploads (either a query or table)?
 

Tay

likes garlic
Local time
Today, 22:05
Joined
May 24, 2002
Messages
269
That's not something I'd considered - I'll give it a go. Thank you.
 

Users who are viewing this thread

Top Bottom