Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

substracting in query

Status
Not open for further replies.

peljo

Technical User
Mar 3, 2006
91
BG
I have a calculated field in my query where one sum is substracted from another.However when there is nothing in the second field, the result is also nothing, while i want to preserve the first value
my expression in the query is : Diff: [imported]-[exported]

if i have 100 items imported and nothing exported, the result is nothing, while i want to be 100
How could i achieve that ?
 
Seems they don't appear to be number fields, I'd have a look at the NZ() function.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Also investigate CInt()

Best option would be to ensure they are both number fields, unless there is a good reason for them not to be.
 
imported: Nz(Sum(someField),0)
exported: Nz(Sum(anotherField),0)
Diff: [imported]-[exported]


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top