Type Conversion Failure (1 Viewer)

Huskergirl

Registered User.
Local time
Today, 01:26
Joined
Apr 24, 2013
Messages
12
I have created a make table query and using expressions for two of the fields. I have set the field properties (format) to "Percent". The expressions are calculating rates based on two other fields. The expressions are currently as such:

PTD_CM_PGM_RATE: IIf((IsError([PTD_CM_REPT_PGM]/[PTD_CM_REPT_ER])),"0%",[PTD_CM_REPT_PGM]/[PTD_CM_REPT_ER])

I'm using the IIF function to avoid potential errors should one or both of the values ("PTD_CM_REPT_PGM" or "PTD_CM_REPT_ER") be zero. However, when running the query, I am getting the "...type conversion failure is caused when the data in one or more fields doesn't match...." error.

Is there a fix for this?

:banghead:

Thanks!!
 

Huskergirl

Registered User.
Local time
Today, 01:26
Joined
Apr 24, 2013
Messages
12
SOLVED: Re: Type Conversion Failure

After working on my issue most of the afternoon, I solved it but wanted to share with whomever might be encountering the same issue. The revised expression is as follows:

PTD_CM_PGM_RATE: IIf([PTD_CM_REPT_ER]=0,0,IIf(IsError([PTD_CM_REPT_PGM]/[PTD_CM_REPT_ER]),0,100*[PTD_CM_REPT_PGM]/[PTD_CM_REPT_ER]))

Hope some will find this useful.

:D
 

Users who are viewing this thread

Top Bottom