Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Dropdown Box

Status
Not open for further replies.

Threl

Programmer
Joined
Mar 5, 2004
Messages
3
Location
GB
I am populating a dropdown box by concatenating several fields returned from a recordset, to form each row. I would like each of the fields to appear in a column within the box. e.g I have strText = rs("name") & rs("descrition") & rs("???").
Can anyone advise on how to format so the fields on successive rows appear in columns, rather than each row appearing as one long string with single or no spaces.
 
Select inputs do not have columns, so the only solution is to ry and fake it.

The easiest method for this would be to set the font for the options to a monospace font, ten calculate the length of each entry so you can pad it with the approprite number of spaces.
The len() function will handle length, the string() function will handle creating a string of epeating characters (like spaces for padding). You can use CSS styles to define the monospace font type (which uses whatever monospace setting the poersons browser has been set to).

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Thanks. Had tried adding spaces within the Option statement but not by creating a padding string first. Will give that a go. Should be simple enough because my field data is fixed length.
 
I have tried to create a padding string but it seems select inputs only recognise one space. If I use any other character it works! Any other ideas. i have tried defining the pad string using actual spaces and the character code 32.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top