Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2015
    Posts
    51

    Question Unanswered: combined fileds in query dropping zero??

    I have a combined field in a query.

    The first field is a two digit code example: 01, 02, 03..... The zero in the code needs to be there.
    The second field is 1, or 0.

    In my query I combined the fields as follows- Newfield: [field1] & [field2]

    The result drops the first zero. so my code looks like 11 instead of 011.

    I have changed the format on the new field to "000", so that it always should have three digits, but its not working.....


    Any clues to solve this tiny problem that has become a big problem.

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    What Datatypes are Field1 and Field2? In order for this to work, Field1 needs to be defined as Text, or you need to convert it to a String, using CStr(), before doing your concatenation.

    A Field with a Number Datatype cannot have a leading Zero.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    You could try
    Newfield: Format([field1],"00") & [field2]

    ??


    MTB

Posting Permissions

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