Results 1 to 5 of 5

Thread: Creating & Storing a large number in Access

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2025
    Posts
    3

    Creating & Storing a large number in Access

    I would like to store both a date and a 5 digit 'invoice number' together in the same field in MSAccess.
    The date could be like '250430' [YYMMDD] and the invoice number maximum '99999' to be stored as '25043099999'.

    Dim strDate As String = "250430"
    Dim strInv As String = "99999"
    Dim mergedString As String = strDate & strInv ' Result: 25043099999

    Just trying to determine most efficient storage field type; Double, Decimal, or Text.
    No calculations would be required later, only sorting and/or truncating left/right sides.

    Appreciate your help

  2. #2

    Thread Starter
    New Member
    Join Date
    Apr 2025
    Posts
    3

    Re: Creating & Storing a large number in Access

    Quick update here, if it doesn't matter the date could be a full YYYYMMDD which may make more sense

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,100

    Re: Creating & Storing a large number in Access

    This is not really a VB.NET question, so I have moved the thread to Database Development.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,100

    Re: Creating & Storing a large number in Access

    As the value is not really a number, I'd store it as text. Formatting the date that way will synchronise chronological and alphanumeric sorting so there's no issue there. I'd say that separating the values as text is more appropriate than a mathematical operation.

    That said, you should not really be storing the date in with the invoice number unless it is actually considered part of the identifier. If it is, store the actual date in a separate column of type Date/Time as well. If you actually need the two separate values, I'd store them in two separate columns. You can then add a third column with data that is automatically generated by combining the other two using an expression.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2025
    Posts
    3

    Re: Creating & Storing a large number in Access

    Thank you sir, wasn't sure if there was any other way of storing. You comment of 'synchronise chronological and alphanumeric sorting' is very helpful.
    And Yes, I do have both values stored in separate fields with appropriate types.

    Cheers,

Posting Permissions

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



Click Here to Expand Forum to Full Width