split field (1 Viewer)

kolait

Registered User.
Local time
Today, 17:02
Joined
Oct 11, 2019
Messages
60
hi
How to split an Access field into several parts?
for example
Divide the numbers below into several fields
2343256787
657876
9876545673
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:32
Joined
Aug 30, 2003
Messages
36,118
What rules govern the split process? Options include Left(), Right(), Mid().
 

kolait

Registered User.
Local time
Today, 17:02
Joined
Oct 11, 2019
Messages
60
The number of digits is different
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:32
Joined
Aug 30, 2003
Messages
36,118
Huh? What do you expect to be the results from each of those numbers?
 

kolait

Registered User.
Local time
Today, 17:02
Joined
Oct 11, 2019
Messages
60
I want the numbers in the report to be in this table
 

Attachments

  • 72.png
    72.png
    31.6 KB · Views: 73

theDBguy

I’m here to help
Staff member
Local time
Today, 05:32
Joined
Oct 29, 2018
Messages
21,358
Hi. If you can give us the rules for splitting your data, we can help you convert it to code.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:32
Joined
Aug 30, 2003
Messages
36,118
So 1 character per field? You're probably going to have to loop the characters, but I don't feel I have enough info to get more specific.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:32
Joined
Aug 30, 2003
Messages
36,118
I'll get out of the way.
 

kolait

Registered User.
Local time
Today, 17:02
Joined
Oct 11, 2019
Messages
60
I have to write the numbers separately in the report. How do I separate numbers? With text functions? Or is there a special code? The number of character numbers is one to ten
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:32
Joined
Oct 29, 2018
Messages
21,358
I have to write the numbers separately in the report. How do I separate numbers? With text functions? Or is there a special code? The number of character numbers is one to ten
Hi. So, if you're saying the "rule" is to separate the digits of a long number, then maybe you could take a look at this as a start. Hope it helps...
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 07:32
Joined
Feb 28, 2001
Messages
27,001
If you have a string of digits as individual characters, you would use the Mid() function and here is a description of how to use it.

https://support.office.com/en-us/article/mid-function-427e6895-822c-44ee-b34a-564a28f2532c

If you have a numeric field (i.e. data type is NOT Short Text or Long Text) and you want to pluck the digits out of it in some manner, you might first convert the number to a string with Stringvar = CStr(number), after which you would apply the Mid() function anyway. Note that if this is all you want, I would use Cstr() and not Str() because Str() includes a leading space for positive numbers.

If you were worried about a specific number of digits in the string, we would have to know more about the requirements, but in general that would involve using the Format() function to make the string have that many characters.

Your answer will be somewhere in there, but (apologies) your question was too vague for me to clearly see what you wanted.
 

Users who are viewing this thread

Top Bottom