Results 1 to 4 of 4
  1. #1
    migaccess is offline Novice
    Windows 8 Access 2007
    Join Date
    Dec 2014
    Posts
    7

    zeros in front of field are dropped

    I created a table which primary key is unique number (6 in total), however if I enter for example 000005, it drops the zeros in front. How can fix this?
    Thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,901
    Change the field to a text type or keep the number type field and use Formatting to display with leading zeros.
    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.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Sounds like you defined the field type as integer or long integer.
    You could change the field type to "Text" and set the field length to 6.

    Having said that, PK fields of type TEXt are not really good as a PK field. See: http://www.fmsinc.com/free/newtips/primarykey.asp

  4. #4
    migaccess is offline Novice
    Windows 8 Access 2007
    Join Date
    Dec 2014
    Posts
    7
    I have changed the field type to text.
    Thanks

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

Similar Threads

  1. Issues with leading zeros in a form field
    By apetriella in forum Forms
    Replies: 2
    Last Post: 02-10-2015, 11:27 AM
  2. Replies: 2
    Last Post: 01-26-2015, 03:53 AM
  3. Dropped/Missing data
    By Xarkath in forum Access
    Replies: 1
    Last Post: 01-09-2015, 04:24 PM
  4. Replies: 2
    Last Post: 01-30-2014, 09:28 AM
  5. Pad Text Field With Zeros in VBA
    By jhrBanker in forum Programming
    Replies: 9
    Last Post: 11-17-2013, 11:35 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