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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dealing with blank fields

Status
Not open for further replies.

NeilT123

Technical User
Jan 6, 2005
302
GB
I have a query which draws in results from several other queries. The result for each record would be for example Answer A, Answer B, Answer C but Answers A,B and C don't always have values so in the query some of the boxes are blank.

I want to perform a mathematical calculation on A,B and C but the calculation doesn't work if A,B and C don't have values.

What is the easiest way around this please?
 
It depends on what you want the result to be if any field is blank.

One option is to use an iif() function to test the value.
iif(isnull(X),0, X*2)

If you want to treat empty values a s zeros then use nz() to convert nulls to zeros.
 
I checked out the Nz function as suggested and it seemed ideal. However I did have to go deep into the original query to work out where to use it but the resultant queries now work fine so thank you both.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top