2
votes

I have a form(not connected to any query or a table) with 3 option button in a frame named "gender" named (male, female, Both) with values(1,2,3), i built a query and wanted to fetch some data from a table with "Gender" field (men value are 1 and women are 2). in query set gender field and in criteria i write this:

IIf([Forms]![frmFilterVolunteer]![Gender]=3;"1 Or 2";IIf(
[Forms]![frmFilterVolunteer]![Gender]=2;1;2))

it works with male and female option button but not with both. how do i manage that?

1

1 Answers

2
votes

Both is the same as saying all, so you only need to filter where the value is 1 or 2. You cannot say "1 or 2" and have the query pick it up. You can use Like and say "*" for both.

LIKE IIf([Forms]![frmFilterVolunteer]![Gender]=3;"*";IIf([Forms]![frmFilterVolunteer]![Gender]=2;1;2))