How to format display ?

  • Thread starter Thread starter Mac
  • Start date Start date
M

Mac

Part_number Char 25
Description Char 30
Date Date 8

output = additem part_nbr+' '+description+date

All the part numbers or descriptions do not have the same lengths so when I
print it, mess up my listbox's display.

How can I print or fix the length of part number, description etc so it
prints the same number of characters?

Thx
 
Mac said:
Part_number Char 25
Description Char 30
Date Date 8

output = additem part_nbr+' '+description+date

All the part numbers or descriptions do not have the same lengths so when I
print it, mess up my listbox's display.

How can I print or fix the length of part number, description etc so it
prints the same number of characters?


First you'll have to specify a fixed width font (e.g.
Courier) for the list box. Then you have to supply the
appropriate number of spaces for each part.

. . . Left(part_nbr & String(26, " "), 26) & . . .

But, I would prefer to find a way to use a table/query for
the list box's RowSource and set the Columns property to 3
so Access lines them up for me.
 
additem space(25-len(part_nbr) & part_nbr) & space(31-len(description) _
&formatdatetime(date, vbGeneralDate)

This will do it. Notice space(31 for description. It is 1 longer than the
field length, so will always show a space. Also, quit using +, it is a math
sign. Proper coding for string concatenation is &. I know + works, but it
is a holdover from Basic version B.C.
 
Back
Top