Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / April 2005

Tip: Looking for answers? Try searching our database.

Can I use an "If" statement in my critera of my query?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jimenda - 24 Apr 2005 07:43 GMT
Can I use an "If" statement in the critera of my query?  If so, I am trying
to return a value from a table in one column based on the condition of
another column?  Is this fesible?  How do I do it?

Thanks
        Jim
Douglas J. Steele - 24 Apr 2005 11:52 GMT
Can you give an example?

If what you're trying to do is return Field3 as the second value in your
query if Field5 has one value, or Field4 otherwise, the simplest approach
would be to have two subqueries and UNION them together:

SELECT Field1, Field3
FROM MyTable
WHERE Field5 = "X"
UNION
SELECT Field1, Field4
FROM MyTable
WHERE Field5 <> "X"

Note that the query will not be updatable (but then, it wouldn't be with any
solution I can think of for this problem...)

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Can I use an "If" statement in the critera of my query?  If so, I am
> trying
[quoted text clipped - 3 lines]
> Thanks
>         Jim
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.