Avatar of Fordraiders
Fordraiders
Flag for United States of America asked on

Userform and Pagetab selection Create unuqie dynamic sql statement based on selections

Excel 2003
vba

Userform1
MultiPage1
several tabs but specifically  "Page4"
33 option buttons ( using the caption names as my value for the "where" sql statement

I currently have no "Frame"


I need to be able to select no more than 3 option buttons at one time.
They can select only 1 or 2 or 3 option boxes

So using I assume a Case Select statement build my "WHERE" sql statement.

BASIC sql Statement below : For 3 Options chosen

SELECT tblXrefInfo.*
FROM tblXrefInfo
WHERE (((tblXrefInfo.MFRNAME)="NAME1")) OR (((tblXrefInfo.MFRNAME)="NAME2")) OR (((tblXrefInfo.MFRNAME)="NAME3"));

NAME1 2 3  would be substituted for 3 option boxes "Caption Value"


Thanks
fordraiders
Microsoft Excel

Avatar of undefined
Last Comment
Fordraiders

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rory Archibald

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Fordraiders

ASKER
ok...just for all , I added a frame control and then assigned the "optionbox" a unique "groupnname" so I could multiselect !
Fordraiders

ASKER
what if I only select "1" control ?
Rory Archibald

It should still work with an IN clause.
Your help has saved me hundreds of hours of internet surfing.
fblack61
Fordraiders

ASKER
ok will try it later
Fordraiders

ASKER
Thanks very much