• Removing leading Zeros (Access 2003 SP2)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Removing leading Zeros (Access 2003 SP2)

    • This topic has 2 replies, 2 voices, and was last updated 17 years ago.
    Author
    Topic
    #451118

    I import a table where the Employee Number is formatted: EMP_00004567 (TEXT Field)

    I use a partial Text extract Query to eliminate the “EMP_” leaving me with 00004567

    So far I remove the Leading Zero manuall by: 1) Changing the TEXT field to a NUMBER field in Design View and SAVE. Then changing it back to TEXT. (It needs to be in TXT)

    I want to automate this as it is updated weekly.

    What Update query can I use to remove the LEADING zeroes without having to change the Table Design?

    Thanks

    Viewing 0 reply threads
    Author
    Replies
    • #1109814

      You could use an expression like this in the update query based on the imported table:

      CStr(Val(Mid([Employee Number],4)))

      The Mid function removes the “EMP_” part, Val converts the remainder to a number and CStr converts this number back to text.

    Viewing 0 reply threads
    Reply To: Removing leading Zeros (Access 2003 SP2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: