Need help with data filtering form (1 Viewer)

nax009

New member
Local time
Tomorrow, 02:51
Joined
Mar 27, 2023
Messages
18
Greeting folks.
I need some help with VBA coding for my filtering form contain a listbox: LstSection which have data from a query name q_mat_A06_00 . Here is the fields and some example data in q_mat_A06_00:

ID (Primary key)CODESHORTNAMEDESCRIPTIONLENGTHSECTIONTYPE
1A 06 00 00A-6 m.Section A 6 m. long6A
2A 06 00 01E-9 m.Section E 9 m. long9E
3A 06 00 02K-10 m.Section K 10 m. long10K

Here is my form design:
1715139735507.png

My requirement:
- Let user filter SECTIONTYPE by using SecFilter toggle buttion group and filter LENGTH by using Lenfilter option buttons group at the same time.
- User can filter LENGTH by any value outside the available option button by inputing in txt_lengt textbox
- User can choose to show all the LENGTH.

Thank you in advance.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:51
Joined
Oct 29, 2018
Messages
21,539
What is the big blank area in the middle? Is that a listbox or a subform?
 

nax009

New member
Local time
Tomorrow, 02:51
Joined
Mar 27, 2023
Messages
18
What is the big blank area in the middle? Is that a listbox or a subform?
Hello. Yes, a list box name LstSection
 

Josef P.

Well-known member
Local time
Today, 21:51
Joined
Feb 2, 2023
Messages
847
2 Tasks:

1. generate filter expression (where condition)
- When changing the length option group, supply the textbox for manual filling with the appropriate value.
- generate condition string with textbox and option group of section

2. set the data source of the list box with this filter
- SelectSql = "select ... from ... where " & ConditionString

Details see attachment.
 

Attachments

  • FilterWithOptionGroups.zip
    71.9 KB · Views: 328

nax009

New member
Local time
Tomorrow, 02:51
Joined
Mar 27, 2023
Messages
18
2 Tasks:

1. generate filter expression (where condition)
- When changing the length option group, supply the textbox for manual filling with the appropriate value.
- generate condition string with textbox and option group of section

2. set the data source of the list box with this filter
- SelectSql = "select ... from ... where " & ConditionString

Details see attachment.
Thank you josef, you've been helpful.
 

Users who are viewing this thread

Top Bottom