D
Desilu via AccessMonster.com
I need to create a function to store in a module that manipulates a table
field in a query. The table field is text, with an additional informational
character stored on the far right. That character is either a “-“ or a “0â€.
The “-“ denotes that the text number should be multiplied by a negative .01.
If the last character on the far right is a “0â€, then the text number should
be multiplied by a positive .01. Of course the far right character is to be
removed before any multiplication.
Example of two possible values stored in the table:
00000001234-
000000012340
I want the function to take the values and turn them into positive/negative
decimals:
From 00000001234- to -12.34
From 000000012340 to a positive 12.34
Below is the formula I used in the query pane field that accomplishes this.
How do I write a function to store in a module to do the same thing?
Expr1: IIf(Right(Trim([MyTextNumField]),1)="-",-0.01*Left(Trim(
[MyTextNumField]),Len(Trim([MyTextNumField]))-1),0.01*Left(Trim(
[MyTextNumField]),Len(Trim([MyTextNumField]))-1))
I’m new with writing VBA functions, so any help would be greatly appreciated.
Thank you.
Desilu
field in a query. The table field is text, with an additional informational
character stored on the far right. That character is either a “-“ or a “0â€.
The “-“ denotes that the text number should be multiplied by a negative .01.
If the last character on the far right is a “0â€, then the text number should
be multiplied by a positive .01. Of course the far right character is to be
removed before any multiplication.
Example of two possible values stored in the table:
00000001234-
000000012340
I want the function to take the values and turn them into positive/negative
decimals:
From 00000001234- to -12.34
From 000000012340 to a positive 12.34
Below is the formula I used in the query pane field that accomplishes this.
How do I write a function to store in a module to do the same thing?
Expr1: IIf(Right(Trim([MyTextNumField]),1)="-",-0.01*Left(Trim(
[MyTextNumField]),Len(Trim([MyTextNumField]))-1),0.01*Left(Trim(
[MyTextNumField]),Len(Trim([MyTextNumField]))-1))
I’m new with writing VBA functions, so any help would be greatly appreciated.
Thank you.
Desilu