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

Forcing IIF function to use number type 1

Status
Not open for further replies.

mollow

MIS
Aug 7, 2001
20
GB
Hi,

I've written a query that performs a calculation to work out a total cost. However sometimes the total cost will have the text 'tba' in it. This means it can't use the SUM function.

I thought i could get around this by using:

IIF([x]="tba", 0, [x])

However, it appears that the 0 is of text type and consequently I still can't use the SUM function.

Am I just being stupid? Is there a way around this problem?

Thanks in advance,

Mike
 
How about:

IIF([x]="tba", CINT(0), CINT([x]))

Terry M. Hoey
 
Ahh,

CInt wonderful thanks.
IIF([x]="tba", CINT(0), CINT([x])) didn't work however,

CINT(IIF([x]="tba", 0, [x]) did :)

Thanks for you help :)

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top