Zachary Tepe
Zachary Tepe

Reputation: 1

Access IIf statement using same-query value as determinant

I'm trying to create a query in Access where a Yes/No is determined by a greater than/less than relationship of two other values in the same query. For example, if CurrentStock < MaxHold, the Yes/No should equal false. If they are equal, it should be true.

This is my current effort, taken from the query design:

Stocked: IIf([Current Stock] (is greater than) [Max_Hold],False,True).

This is different from related questions in that it the others detail the inverse, i.e. how to use a yes/no to determine a value. My issue is that I'm not sure how to use the input value of "CurrentStock" as the determinant for the Yes/No, however.

Upvotes: 0

Views: 38

Answers (1)

Gustav
Gustav

Reputation: 55981

Or directly:

Stocked: [Current Stock]>[Max_Hold]

or, if you prefer:

Stocked: CBool([Current Stock]>[Max_Hold])

Upvotes: 0

Related Questions