Selasa, 13 September 2011

[MS_AccessPros] Re: Logic/SQL/Checkbox issue.. I have 5 chkboxes need to know if more than 1 is chec

 

Terence

Try this:
SELECT *
FROM tbl_profile
WHERE (AI + AS + AA + NH + WH) < -1

If only one is selected the outcome would be -1. If more than one are selected the sum would be anywhere from -2 through -5.

The above would of course need to be edited if you ever added another ethinic field.

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile/Bill.Mosca

--- In MS_Access_Professionals@yahoogroups.com, "Terence" <buffalome90210@...> wrote:
>
> I dont have a lot of room to move on this issue because I am dealing with Fed Standards. I have 5 check boxes, as follows
>
> American Indian or Alaskan native
> Asian
> African American
> Native Hawaiian or Other Pacific Islander
> White
>
> I pass the data several times with a typical query such as:
>
> mysql = "select * from tbl_profile where (AI = True and AS = False and AA = False and NH = False and WH = False)"
>
> I have to allow the partipant to click more than one box (Fed Standard)
>
> I need a query to select when more than one of the boxes is checked.
>
> I can't use a custom control because I must allow multiple selections.
>
> If I have to I could put some logic in, but I was hoping to find a better way.
>
> all i can see is something like
>
> COUNT = 0
> If AI = true then COUNT = COUNT + 1
> If AS = true then COUNT = COUNT + 1
> If AA = true then COUNT = COUNT + 1
> If NH = true then COUNT = COUNT + 1
> If WH = true then COUNT = COUNT + 1
>
> If COUNT > 1 then
> msgbox("I got more than 1 box")
> endif
>
>
> ANY SUGGESTIONS ?
> Terence
>

__._,_.___
Recent Activity:
MARKETPLACE
A bad score is 598. A bad idea is not checking yours, at freecreditscore.com.

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar