Forum Moderators: open

Message Too Old, No Replies

How can I display only the first 15 characters of a field?

         

kevinj

4:32 pm on Jan 26, 2003 (gmt 0)

10+ Year Member



I have a login page that companies select their name from a dropdown menu and enter their password to login. Some of the company names are quite long so I want to display only the first 15 characters of their company name. Here's the code I have that displays the whole name:

Set RS = DB.execute("SELECT * FROM EXHIBITORS WHERE
left(exhibitor_name,1) IN ('a','b','c','d','e','f','g') ORDER BY exhibitor_name ASC")

Response.Write("<option value=1>" & "Select Your Organization")
While not RS.eof
EXHIBITOR_ID = RS("exhibitor_id")
EXHIBITOR_NAME = RS("exhibitor_name")
Response.Write("<option value=" & EXHIBITOR_ID & ">" & EXHIBITOR_NAME)
RS.movenext()
Wend
RS.close

Thanks for any help on this question.

chris_f

4:43 pm on Jan 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To display the first 15 characters you use the left command.

e.g. Response.Write(Left(Variable_Name, 15))

Chris

kevinj

4:51 pm on Jan 26, 2003 (gmt 0)

10+ Year Member



Perfect! Thanks Chris.

chris_f

4:53 pm on Jan 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



no probs