truncate leading 0's in a string

  • Thread starter Thread starter Darryl
  • Start date Start date
D

Darryl

Greetings,
I have a basic report that uses a query as a data source. I have a field on
the report that
uses a field (text field) from the query.

The data in the table is like: 00000000089907

In the report I want to chop off the leading 0's.

I tried control source: =Right([myfield],7)

but that just gave errors.

how do you do this ?

thanks in advance.
 
Use the Val() function to get the numeric value of the string:
=Val([myfield])

If the field could be Null, use:
=IIf([myfield] Is Null, Null, Val([myfield])

BTW, check the Name property of the text box. Access gets confused if a
control has the same Name as a field, but it is bound to something else.

(Of course, changing the field to a Number type would be a better solution.
You can use the Format property to show the leading zeros where needed.)
 
Back
Top