Access 2002, Combining potentially 4 fields into 1

L

laurenm

I am working in an Access 2002 database and I am trying to combine 4 fields
into 1 field in a select query. For example, in my form, the user can select
up to 4 options, each option links back to its own field in the table. Option
1 is "Physician", Option 2 is "Nurse", Option 3 is "Pharmacist", and Option 4
is Respiratory Therapist". I have the table fields set up as Yes/No fields so
they user can just check what they want in the form and I set up a query that
turned the results into names. Depending on what option they pick, I want to
show its name (Example, if they pick option 1, it will be "True" and I want
to see "Physician" in my query results.) Now if the user picks option 1 and 3
but not option 2 or 4, I want to see "Physician, Pharmacist". In my query
result now, I get the result of Physician, ,Pharmacist,) The statement I am
writing is as follows:

Programs: IIf([Type of Program]=True,[Type of Program] & IIf([Type of
Program2]=True,"," & [Type of Program2] & IIf([Type of Program3]=True,"," &
[Type of Program3] & IIf([Type of Program4]=True,"," & [Type of Program4]))))

What am I doing wrong? If anyone could help me, I would greatly appreciate
it.

Thanks!
LaurenM

FYI, I am not that great with code. I am learning but I am certaintly not
that great with it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top