criteria with query (1 Viewer)

Bladerunner

Registered User.
Local time
Today, 13:29
Joined
Feb 11, 2013
Messages
1,799
Can I place a criteria in a calculated field? [SellingWgt]*[SellingPrice] is ok but only
if [SellingUnits] = "lbs" or [tblSellingUnits].[SellingUnitsID] = 1

Just have a problem finding it in the tutorials


Blade
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:29
Joined
Aug 30, 2003
Messages
36,128
I don't use calculated fields, but I would assume the query would (or could) include either of those fields, and the criteria would be on them.
 

Bladerunner

Registered User.
Local time
Today, 13:29
Joined
Feb 11, 2013
Messages
1,799
I don't use calculated fields, but I would assume the query would (or could) include either of those fields, and the criteria would be on them.

OK,,,thanks

Blade
 

smig

Registered User.
Local time
Today, 23:29
Joined
Nov 25, 2009
Messages
2,209
Yes you can
Use iif()
You need to set what will it get in other cases, or it will be null
 

Bladerunner

Registered User.
Local time
Today, 13:29
Joined
Feb 11, 2013
Messages
1,799
Yes, sir: it is working fine with IIF statement in the top row.

Total Price: IIf([SellingUnits]="lbs",[SellingWgt]*[SellingPrice],[SellingPrice]*1)


Thanks pbaldy

Blade
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:29
Joined
Aug 30, 2003
Messages
36,128
I think I misunderstood what you were after, but glad you got it sorted.
 

smig

Registered User.
Local time
Today, 23:29
Joined
Nov 25, 2009
Messages
2,209
Yes, sir: it is working fine with IIF statement in the top row.

Total Price: IIf([SellingUnits]="lbs",[SellingWgt]*[SellingPrice],[SellingPrice]*1)


Thanks pbaldy

Blade

You can use as asked in your first post:
Total Price: IIf([SellingUnits]="lbs" or [tblSellingUnits].[SellingUnitsID] = 1,[SellingWgt]*[SellingPrice], [SellingPrice])
 

Users who are viewing this thread

Top Bottom