Share via

Long Number format in Microsoft Access

Anonymous
2023-12-23T01:40:30+00:00

Hello, I think I'm missing something when going through my formatting. I am utilizing a "Long Number" format in one of my columns to input values of roughly 22 digits (barcode) to make sure no letters ever get mis-input like in a text column, however I just get "the value you have entered does not match the large number format" whenever I try.

Microsoft 365 and Office | Access | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2023-12-24T13:54:22+00:00

    I'd recommend that you follow Imb's advice and use a short text data type for this column.  Numeric data types are best reserved for attributes which have an ordinal or cardinal significance, or, in the case of an autonumber, as a distinct row identifier, usually designated as the primary key of the table.

    Bar codes and the like are not really numbers per se, but encoding systems (Joe Celko has a whole chapter on these in one of his books, 'Data and Databases: Concepts in Practice' if I remember rightly).  One problem often encountered with these is that a numeric data type cannot store leading zeros, although it cannot be formatted as such.  When using the 'number' therefore, it is necessary to call the Format function.  By using a text data type this is unnecessary.

    1 person found this answer helpful.
    0 comments No comments
  2. Tom van Stiphout 40,201 Reputation points MVP Volunteer Moderator
    2023-12-23T16:32:06+00:00

    Please use precise language. Did you really mean "Long Number"?
    We have the Number data type in Access, as well as the Large Number data type in special cases.
    For the Number data type, we have different Field Sizes such as Long Integer and Integer.

    "Long Number" as a term does not exist in Access. Please clarify.

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2023-12-23T08:49:24+00:00

    Hello, I think I'm missing something when going through my formatting. I am utilizing a "Long Number" format in one of my columns to input values of roughly 22 digits (barcode) to make sure no letters ever get mis-input like in a text column, however I just get "the value you have entered does not match the large number format" whenever I try.

    Hi Torkelson J,

    As a rule of thumb, barcodes, but also telephone numbers, bank account numbers, postal codes, I always define them as a string. Their only purpose is to be unique, and you will never use them in an arithmatic calculation.

    Anyway, you are then independant of what characters are used.

    I hope the users do not input the barcode directly in "one of my columns" of a table, but always using a form. In that case you can block the control on the form for manual input, but only use a barcode reader as input.

    Imb.

    1 person found this answer helpful.
    0 comments No comments
  4. Duane Hookom 26,820 Reputation points Volunteer Moderator
    2023-12-23T13:31:20+00:00

    Use a text field with an input mask or simple code in the key press event of the control. You can find a list of the ascii values on this page. Here is some code that can be used in the KeyPress event

    Private Sub txtNumbersOnly_KeyPress(KeyAscii As Integer) 
    
        'code to ignore all but numbers and 
    
        Select Case KeyAscii 
    
            Case 48 To 57    'numbers 0 - 9 
    
                'let it go 
    
            Case 8 To 13     'backspace, tab, etc 
    
                'also let it go 
    
            Case Else 
    
                KeyAscii = 0 
    
                Beep         'make it annoying to the user 
    
        End Select 
    
    End Sub
    
    0 comments No comments
  5. Bill Yuen 700 Reputation points
    2023-12-23T02:17:00+00:00

    Hello,

    My name is Bill and I am happy to help. It seems like you're running into an issue with the Long Number format in Microsoft Access. The error you're encountering might be due to the input not conforming to the expected format.

    When dealing with long numbers, make sure you're not including any non-numeric characters, such as dashes or spaces. Also, check if your number exceeds the maximum limit for the Long Integer data type in Access, which is 2,147,483,647.

    If your barcode is really long and exceeds the Long Integer limit, consider using the "Text" data type instead. This way, you can store the entire barcode as a string without any issues. Just be cautious about performing numerical operations on it, as it will be treated as text.

    Try that and let me know if I answered your question, or if you have additional questions. Thanks.

    0 comments No comments