Results 1 to 6 of 6
  1. #1
    lsm is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    3

    leading zeros combined with strings

    Hi everybody,



    even if i am one of the new members of this board i am hoping to get some help...

    Actually it is an easy problem i guess, even though i did not find a solution googling for quite a while...
    I have a table with (integer) numbers! using the format "00000" i can make sure that it will be 5 digits.

    No i am aiming to combine the five digit number with a text in another column and do not succed at all.

    what i want to get:
    column A: number (e.g. 1)
    column B: number 4 digits (e.g. 0001)
    column C: number combined with string (e.g. ab0001cd)


    of course it would be a nice one to skip the coluimn B! - what ever i tried ended up in sth. like "ab1cd" at the best....

    any ideas? - maybe it is a really easy one, but i am quite new to access...

    thanks a bunch

    lsm

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,529
    "ab" & Format(ColumnA, "00000") & "cd"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    lsm is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    3
    well thanks for the fast replay... - that's what i tried before, but it does not work.... maybe there is an (easy) stupid mistake i do...
    so what i do....
    1) craete a new table
    2) add a column with number and call it "numbers"
    3) add another column by choosing "calculate field - text" (if not exactly correct - sorry i am using the german version...) and add the following: "ab" & Format([numbers], "00000") & "cd" as a command

    ->Trying to hit "OK" ends up getting an error telling me the syntax is wrong.

    what have i done wrong??

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,953
    Calculated field in table does not recognize all functions. Format is not one. Can't do this in table. Must be in query or in textbox on form/report.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,529
    Welcome to the site. I'll stay out of the way.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    lsm is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    3
    oh i see... well thx a bunch!!! now i understand why it did not work out...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Trying to get leading zeros to show
    By Pegasus_Angel in forum Access
    Replies: 3
    Last Post: 10-25-2012, 11:40 AM
  2. Leading Zeros in Access 2010
    By aa_weber in forum Access
    Replies: 3
    Last Post: 10-16-2011, 11:17 PM
  3. Leading Zeros
    By dirtbiker1824 in forum Access
    Replies: 1
    Last Post: 03-14-2011, 02:16 PM
  4. Adding Leading Zeros
    By jo15765 in forum Access
    Replies: 13
    Last Post: 11-20-2010, 11:11 PM
  5. leading 'Zeros' in data
    By wasim_sono in forum Forms
    Replies: 3
    Last Post: 04-06-2009, 11:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums