-----Original Message-----
Tim said:
I have a query as the following:
Select ID & " " & Value as test from Table1;
The output is like the following
Test
1 12
2 13
99 14
997 12
Is there a way to line up the data?
Test
1 12
2 13
99 14
997 12
Hi Tim,
You can compute the number of
SPACES needed between ID and
[Value], but to get a "meaningful display"
in query view you would need to change
font for *all* datasheets to a non-proportional
font like Courier New. I don't think you want
to do that.
You could just have a report bound to
SELECT Id, [Value] FROM Table1;
Set textbox for Id to left-justified
and textbox for [Value] to right-justified,
then adjust their widths and spacing.
The SPACE calculation (which I doubt
you really want) might look like:
Select
ID & SPACE(10-Len(ID & "") - Len([Value] & "")) & [Value] as test
from Table1;
ID = 1
Value=12
?ID & SPACE(10-Len(ID & "") - Len(Value & "")) & Value
1 12
ID = 997
Value=12
?ID & SPACE(10-Len(ID & "") - Len(Value & "")) & Value
997 12
You could play with "10"
ID = 1
Value=12
?ID & SPACE(8-Len(ID & "") - Len(Value & "")) & Value
1 12
ID = 997
Value=12
?ID & SPACE(8-Len(ID & "") - Len(Value & "")) & Value
997 12
but something like below will cause RunTime Error 5
ID = 9997
Value=120000
?ID & SPACE(8-Len(ID & "") - Len(Value & "")) & Value
You could protect SPACE function from negative argument
ID = 9997
Value=120000
?ID & SPACE(Abs(8-Len(ID & "") - Len(Value & ""))) & Value
9997 120000
but you lose "constant spacing".....
you just won't have to worry about error.
Plus, proportional fonts will trash this
"constant spacing" anyway.
I recommend the report approach.
Good luck,
Gary Walter
.