Results 1 to 2 of 2
  1. #1
    dcwaits is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2015
    Posts
    2

    Query with # field with leading zero in criteria


    I have an ODBC connection to a dB that has [customer number] field that may or may not have a leading zero. The field is a number field. If I leave out the leading zero in my criteria, my customer is not found. If I enter the number with leading zero in the criteria Access is happy to strip it out for me. Any Ideas how to force the leading zero in a criteria? Quotes "012345" makes my criteria text and I get a data type mismatch.

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    What kind of database is this exactly that you are connecting to via ODBC?

    What happens if you create a query and enter this calculated field?
    Check: IsNumeric([FieldName])
    What does it return?

    If the field is truly "numeric", it cannot have a leading zero. Leading zeroes mean nothing to numeric values and are dropped.
    If it has a leading zero, it is probably Text.

    The only thing I can think of is if this is an Excel file that has "mixed" values (some Numeric, some Text).

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. Replies: 9
    Last Post: 12-05-2013, 11:48 AM
  4. Adding leading spaces to a field
    By johnbr in forum Queries
    Replies: 1
    Last Post: 12-13-2011, 11:31 AM
  5. Replies: 2
    Last Post: 11-04-2011, 09:14 AM

Tags for this Thread

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