Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Start with Zeros (Access2000-03)

    Hello!
    I have 2 tables with IDs where in one table all IDs are 5 digits.
    In another some IDs are missing Zeros at the beginning.
    I need add that zero to 4 digit IDs.
    Please, help.

    I am trying IIf (Len([EMPLID]=4,( Replace([EMPLID],("0"&([EMPLID])),[EMPLID])) but syntax is wrong
    Thanks so much!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Start with Zeros (Access2000-03)

    Are the IDs number fields or text fields?

  3. #3
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Start with Zeros (Access2000-03)

    text

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Start with Zeros (Access2000-03)

    Try
    <code>
    Right("0" & [EMPLID], 5)
    </code>
    This is more efficient than using IIf.

  5. #5
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Start with Zeros (Access2000-03)

    This is very awesome and works like a charm.
    Thanks so much, Hans!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •