group numbers in groups of five in a textbox?

  • Thread starter Thread starter Jen
  • Start date Start date
?> 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.
 
?> 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
 
?> 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.
 
?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, "@@@@@ @@@@@ @@@@@"))
 
Back
Top