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!

Dividing by zero 1

Status
Not open for further replies.

netrusher

Technical User
Joined
Feb 13, 2005
Messages
952
Location
US
I have three columns in a query.

A-----B-----C

I am dividing Column A by Column B with the Results in Column C

My issue is when Column B is 0. What I need is if column B is 0
I really need for Column A to be divided by 1 and appear in Column C.

How can I solve this problem?

 
ColumnC: [ColumnA] / IIF([ColumnB] = 0, 1, [ColumnB])

Of course, change Column names as appropriate

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Works great and thanks a lot!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top