Selection Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Is it possible to select different fields from one tabel depending on wether
different selection boxes are ticked or not? I would like to write an
SQL-query like this:

SELECT Register.[E-mail_1]
FROM Register
WHERE (((Register.[Selection_1])=Yes)) AND
(SELECT Register.[E-mail_2]
FROM Register
WHERE (((Register.[Selection_2])=Yes))) AND
(SELECT Register.[E-mail_3]
FROM Register
WHERE (((Register.[Selection_3])=Yes)));

Access doesn't understand this code. Is there any other way to express this?
I'm very greatful for all help.

Best regards
Ã…sa
 
Why not try making a regular query in the qeury designer. There you can add
your checks to the criteria as true, true, true

So a regular query should do the trick. If you do need the SQL-statement you
could alsways look under the Datasheet view button and tick the SQL-view
option. This shows you the SQL-string.

Maurice
 
If I have understood correctly then some nested IIF statements should do the
trick.

Look IIF up in Help.

In design view it could look something like (untested air code):

Email: IIF(Register.[Selection_1]=Yes, Register.[E-mail_1] ,IIF
(Register.[Selection_2]=Yes, Register.[E-mail_2],
IIF(Register.[Selection_2]=Yes,Register.[E-mail_3],"")))

That may not be the logic that you want, but you should be able to work it
out.
 
Back
Top