Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Conditional returns in queries

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-09-12 : 10:59:29
John writes "Dear Guru,

I'm working on an Access application at work, and I'mt rying to get over this stumper. Instead of getting into the specifics of my ap, I'll ask generally.
Suppose I have a number that is different for each record in a table, COUNT. I also have a different number in each row that COUNT needs to be compared to, call it SETPOINT.
For each indivudual row, I need to return a value in a query. If COUNT is less than SETPOINT, I need to return COUNT. If COUNT is more than SETPOINT, I need to return SETPOINT.
Making sense?

I need to do this for many rows. I've tried coming up with a way in VB code and in SQL code and wasn't successful with either.

Please help!

-John"

smccreadie
Aged Yak Warrior

505 Posts

Posted - 2002-09-12 : 11:18:00
Look up the IIF statement in Access. I think this will do what you want.

Go to Top of Page

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2002-09-12 : 11:23:15
Can you use the IIF statement in your query something like.......

IIf(count<Setpoint, Count, NULL) OR IIF(count>Setpoint, Setpoint, NULL)


===========
Paul
Go to Top of Page
   

- Advertisement -