?
Solved

Select using multiple check text boxes

Posted on 2008-10-12
3
Medium Priority
?
162 Views
Last Modified: 2012-05-05
Hi,

I am using access and asp.

I want to use 4 check boxes to allow users to choose what to view.  What should my sql be to allow for all combinations?

The check boxes are called L1, L2, L3, L4.

This is my SQL at the moment

SELECT TOP " & Request("myNumber") & " tblPupil.PupilID, Count(tblBehaviour.ID) AS mytotal, tblPupil.Surname, tblPupil.FirstName FROM tblPupil INNER JOIN tblBehaviour ON tblPupil.PupilID = tblBehaviour.PupilID WHERE (([Level] = 'L1' OR [Level] = 'L2' OR [Level] = 'L3' OR [Level] = 'L4') AND tblPupil.TutorGroup LIKE '" & Request("myYear") & "%') GROUP BY tblPupil.PupilID, tblPupil.Surname, tblPupil.FirstName ORDER BY Count(tblBehaviour.ID) DESC

This shows all Levels.  I want to display L1, L2, L3 and L4 based on the user choice of checking the check boxes.

Thanks,

Desi
0
Comment
Question by:DesiMck
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Expert Comment

by:Cvijo123
ID: 22698313
something like this in your where clausule:


 WHERE (([Level] = '& Request("myL1")  &' OR [Level] = '& Request("myL2")  &' OR [Level] = '& Request("myL3")  &' OR [Level] = '& Request("myL4")  &')
0
 
LVL 1

Author Comment

by:DesiMck
ID: 22698432
Yep but what if they don't check one of the boxes. If they didn't check L1 wouldn't the SQL be:

WHERE (([Level] = '' OR [Level] = '& Request("myL2") &' OR [Level] = '& Request("myL3") &' OR [Level] = '& Request("myL4") &')
 
??
0
 
LVL 1

Accepted Solution

by:
DesiMck earned 0 total points
ID: 22698576
Thanks,
 
I found the answer here - http://bytes.com/forum/thread611445.html
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question