-
Apr 29th, 2025, 12:54 AM
#1
Thread Starter
New Member
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
-
Apr 29th, 2025, 01:07 AM
#2
Thread Starter
New Member
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
-
Apr 29th, 2025, 01:42 AM
#3
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.
-
Apr 29th, 2025, 01:46 AM
#4
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.
-
Apr 29th, 2025, 02:55 AM
#5
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|