From: RyNC on
Hi,

I need some help with the below IF statement for update query. I got it to
move the negative sign to the front of the number, but now it is removing all
numbers after my decimal point. I've checked to make sure my formatting for
[MyNumericField] is double and 2 decimal points.

For example:

[MyTextField] is 23.32-

I run update query and....

[MyNumericField] is -23


Here is what I have for the update query:

UPDATE [MyTable] SET [MyTable].[MyNumericField] =
IIf(Right([MyTextField],1)="-",-CLng(Left([MyTextField],Len([MyTextField])-1)),CLng([MyTextField]))

Thanks,
RyNC

From: Dorian on
CLng is dropping the fractional part.
Try using CDbl ?
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"RyNC" wrote:

> Hi,
>
> I need some help with the below IF statement for update query. I got it to
> move the negative sign to the front of the number, but now it is removing all
> numbers after my decimal point. I've checked to make sure my formatting for
> [MyNumericField] is double and 2 decimal points.
>
> For example:
>
> [MyTextField] is 23.32-
>
> I run update query and....
>
> [MyNumericField] is -23
>
>
> Here is what I have for the update query:
>
> UPDATE [MyTable] SET [MyTable].[MyNumericField] =
> IIf(Right([MyTextField],1)="-",-CLng(Left([MyTextField],Len([MyTextField])-1)),CLng([MyTextField]))
>
> Thanks,
> RyNC
>