group numbers in groups of five in a textbox?

J

Jen

?> Please explain, perhaps with an example of the data that you're grouping
and
how you want the result to come out.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com

Sorry for explaining badly;

1234567890123 should come out in groups of five starting from the end like:
123 45678 90123

In a calculated textbox on a form.
 
J

John W. Vinson

?> Please explain, perhaps with an example of the data that you're grouping
and

Sorry for explaining badly;

1234567890123 should come out in groups of five starting from the end like:
123 45678 90123

In a calculated textbox on a form.

How's the data stored in the table? A single big Text field, one digit per
record, one digit per field, something else?

Assuming that you have a large Text field set the Format property of the
textbox to

@@@@@ @@@@@ @@@@@

with as many groups of five as you need for the field.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
J

Jen

?> How's the data stored in the table? A single big Text field, one digit
per
record, one digit per field, something else?

Assuming that you have a large Text field set the Format property of the
textbox to

@@@@@ @@@@@ @@@@@

with as many groups of five as you need for the field.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com

The amount of numbers there differs. Your proposal of @@@@@ @@@@@ @@@@@
works, but if the numbers are lets say 123456789 then there is empty before
the number ( 123 456789), and the numbers should be aligned
left.
 
J

Jen

?Thank you so much mbyerley and John!

mbyerley said:
Actually, John's answer with the addition of LTrim is better:

Dim s As String
Dim sGrp As String
s = "234567890123"
sGrp = LTrim$(Format(s, "@@@@@ @@@@@ @@@@@"))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top