syntax help please

Results 1 to 7 of 7

Thread: syntax help please

  1. #1
    marie Guest

    Default syntax help please

    I have a drop down list populated from a database, and I have three fields displayed. So far I&#039ve managed to put spaces in between the field values, BUT, I&#039d ultimately like to have them line up nicely. The values for the first field will never be more than 50 characters and the other two are fine with just a space in between them, because they are date and time fields, so I pretty much want this (see below) to happen, but I&#039m not sure what the correct syntax should be for visual basic, I just know that this isn&#039t right. Any help would be greatly appreciated.<BR>Thanks.<BR>&#060;% Do While not RS.EOF %&#062;<BR>&#060;OPTION VALUE="&#060;%=RS("Field1")%&#062;"&#062; <BR>&#060;%=RS.fields("Field2")%&#062;<BR>&#060; !-- the stuff above works, just added it for clarity--&#062; <BR>&#060;%<BR>dim spaces<BR>spaces= 50 - len("Field2") + 5 <BR>Do While spaces &#062;=0<BR>response.write &"" ""&<BR>&#060;!-- trying to get it to output spaces--&#062;<BR>spaces--<BR>&#060;!-- trying to de-increment the value held in spaces--&#062;<BR>Wend<BR>%&#062;<BR>&#060;!-- this stuff below works, just added it for clarity--&#062; <BR>&#060;%=" "%&#062;<BR>&#060;%=RS.fields("Date")%&#062;<BR>&# 060;%=" "%&#062;<BR>&#060;%=RS.fields("Time")%&#062;<BR>&# 060;%=" "%&#062;<BR>&#060;%<BR>RS.MoveNext<BR>Loop<BR>RS.C lose<BR>%&#062;<BR>

  2. #2
    Steve Cimino Guest

    Default RE: syntax help please

    VB doesn&#039t support the decrement operator --.<BR><BR>YOu have to use this:<BR><BR>space = space - 1

  3. #3
    marie Guest

    Default RE: syntax help please

    it&#039s really mostly having trouble with the response.write &"" ""&<BR>(thank you, I fixed that part)

  4. #4
    Steve Cimino Guest

    Default How about this then?

    Are you trying to place a space between your records then?<BR><BR>Then you should be using the HTML non breaking space:<BR>& n b s p ; without the spaces between them.<BR><BR>Also, get rid of all your opening/closing ASP tags. This leads to performance degradation.<BR><BR>Use instead:<BR>Response.Write "& n b s p;" & RS.fields("Date") & "& n b s p;" & RS.Fields("Time")<BR>...movenext..<BR><BR>loop

  5. #5
    Marie Guest

    Default it kind of works now...

    I replaced the response.write &"" ""& with the response.write"&nbsp;" and now it that part works, (I also had to change the wend to loop) but I think now it&#039s having trouble with exactly how many it&#039s supposed to be putting in. (I&#039m trying to put in 50 spaces - the length of the string contained in the field plus 5 more... so my date and time fields will line up in the drop down list, no matter how long the string in the field is, the date should always start 55 spaces from the beginning.)<BR>Thanks for your help.

  6. #6
    Steve Cimino Guest

    Default RE: it kind of works now...

    Are these values all in a combo box? Ok.<BR><BR>So, you want the date to always be 55 spaces away from the edge, but you have to pad the spaces accordingly with the length of whatever field you have in front of it. Ah.<BR><BR>x = 55 - Len(yourstring)<BR>Response.write "field1" & Space(x) & "field2"<BR><BR><BR>That what you&#039re looking for?

  7. #7
    Steve Cimino Guest

    Default Side note

    That won&#039t work in a Response.write, but the spaces will show up in your combo box. Just be sure to wrap quotes around the entire thing on the HTML side.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts