If statement for select query

mad-q

Registered User.
Local time
Today, 05:40
Joined
Feb 14, 2010
Messages
61
Hello, After hunting high and low online i'm not even sure if what i'm trying to do is possible.

I would like to select many fields where one field = yes, or select different fields where that field = no.

This is used for if a person wants the parcel to go to their home address there is a tick box that states Home, so the label will pull up fields from their home address, where as if they have work address selected then it will add their work address fields to put onto the label.

Thoughts? Many Many Thanks.

eg If "Work Address"="-1" then Select "Work Address Details" else Select "Home Address Details";
 
A dynamic query:
Code:
select IIF([Work Address],[WorkAddress Details],[Home Address Details]) from table1
You could check whether the value [Work Addrress] = True or -1 but in an If statement checking for a true value, you can leave that part out.
Code:
select IIF([Work Address] = -1,[WorkAddress Details],[Home Address Details]) from table1

Share & Enjoy!
 
Wonderfull,

Many thanks, would you know is there a simple way to get it to return more than one field, ie Home Address & Home Postcode. At present I just have 5 IIF statements for each address line.

Yours
Iain
 

Users who are viewing this thread

Back
Top Bottom