calculated field with conditions

S

schongresh

In the query design view I am trying to make a calculated field total
certain amounts based upon the contents of a certain field. The
statement reads:

IIf([recShortName]<>"sm/TRACTORS" Or "sm/WASH ALL TRAILERS" Or
[recShortName] Not Like "bnsf*",Nz([bilUnit1],0)+Nz([bilUnit2],
0)...etc.,0)

The field is calculating in each record whether or not recShortName
matches or not. I would like some guidence on how to arrange to
statement with the proper syntax and logic.

The goal is to find to records where [recShortName] does not equal "sm/
TRACTORS" or "sm/WASH ALL TRAILERS" or does not contain the text "bnsf
".
 
D

Dirk Goldgar

In
schongresh said:
In the query design view I am trying to make a calculated field total
certain amounts based upon the contents of a certain field. The
statement reads:

IIf([recShortName]<>"sm/TRACTORS" Or "sm/WASH ALL TRAILERS" Or
[recShortName] Not Like "bnsf*",Nz([bilUnit1],0)+Nz([bilUnit2],
0)...etc.,0)

The field is calculating in each record whether or not recShortName
matches or not. I would like some guidence on how to arrange to
statement with the proper syntax and logic.

The goal is to find to records where [recShortName] does not equal
"sm/ TRACTORS" or "sm/WASH ALL TRAILERS" or does not contain the text
"bnsf ".

IIf(([recShortName]<>"sm/TRACTORS" And
[recShortName]<>"sm/WASH ALL TRAILERS")
Or [recShortName] Not Like "*bnsf*",
Nz([bilUnit1],0)+Nz([bilUnit2],0)...etc.,
0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top