#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2011
    Posts
    6
    Rep Power
    0

    Question Beginner having trouble with a form display and query


    Im currently taking a class to learn ASP and various other languages, and so far I have been doing ok but for some reason I have hit a wall on the current script and I need some help. For whatever reason, the initial form fields are not loading in pass 1 and I cant get to the next step if I cant see the fields to add query data. If anyone can point out what I am missing I would greatly appreciate it!!

    Code:
    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="VBScript">
    <!--
    Sub GoBackBut_OnClick
    
    window.location.href="http://auckland.bauer.uh.edu/Students/gl1363/index.htm"
    
    end sub
    -->
    </script>
    </HEAD>
    <body  bgcolor="#808080" link="#ffffff" text="#ffffff" vlink="#ffffff">
    
    <table border="1" width="95%" cellspacing="0" cellpadding="0">
    <tr>
    <td colspan="4">
    <center>
    &nbsp;
    </td><td colspan="2" align="center" valign="middle"><font size="5">
    <font face="COMIC SANS MS,HELVETICA,ARIAL" size="3"><b>Higgins' GL Assignment</b>
    <p>
    GL Account Query
    <p>
    <font face="COMIC SANS MS,HELVETICA,ARIAL" size="2"><a href="http://auckland.bauer.uh.edu/students/gl1363/">HOME</a>
    </center>
    </td>
    </tr>
    
    <tr>
    <td>&nbsp;
    MAJOR&nbsp;
    </td>
    <td>&nbsp;
    MINOR&nbsp;
    </td>
    <td>&nbsp;
    SUB 1&nbsp;
    </td>
    <td>&nbsp;
    SUB 2&nbsp;
    </td>
    <td>&nbsp;
    ACCOUNT DESCRIPTION&nbsp;
    </td>
    <td>&nbsp;
    BALANCE&nbsp;
    </td>
    </tr>
    
    
    <%
    '
    '*** globals
    '
    dim cn
    dim rs
    dim tokenvalue
    
    
    %>
    
    
    <form name="accountform" action="http://auckland.bauer.uh.edu/students/gl1363/a45.asp" METHOD="POST">
    <tr>
    <td><INPUT TYPE="TEXT" NAME="Major" size="4" maxlength="4"></td>
    <td><INPUT TYPE="TEXT" NAME="Minor" size="4" maxlength="4"></td>
    <td><INPUT TYPE="TEXT" NAME="Sub1" size="4" maxlength="4"></td>
    <td><INPUT TYPE="TEXT" NAME="Sub2" size="4" maxlength="4"></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    <tr><td colspan="6"><br><center>
    <input type="hidden" name="token" value="2"><p>
    <input type="submit">
    </td>
    </tr>
    </FORM>
    
    <%
    sub pass1
    
    end sub
    
    sub pass2
      response.write "<P>Pass 2 tokenvalue="+cstr(tokenvalue)
      set rs=Server.CreateObject("ADODB.Recordset")
    
      majvalue=request.form("Major")
      minvalue=request.form("Minor")
      SQLString="SELECT * FROM glmaster WHERE major="+cstr(majvalue) +" AND minor="+cstr(minvalue)
      response.write "<P>Open account rs with SQL--->"+cstr(SQLString)+"<------ "
      rs.open SQLString,"omitted"
      response.write "<P>Recordset opened OK"
    
    	Response.write "<p><table border="+chr(34)+"1"+chr(34)+">"
    	Response.write "<tr><td>major</td><td>minor</td><td>sub1</td><td>sub2</td><td>acct desc</td><td>balance</td></tr>"
    
       c=0
       while NOT rs.EOF
          c=c+1
    	Response.write "<tr><td align="+chr(34)+"right"+chr(34)+">"
    	Response.write rs("major")
    	Response.write "</td><td align="+chr(34)+"right"+chr(34)+">"
    	Response.write rs("minor")
    	Response.write "</td><td align="+chr(34)+"right"+chr(34)+">"
    	Response.write rs("sub1")
    	Response.write "</td><td align="+chr(34)+"right"+chr(34)+">"
    	Response.write rs("sub2")
    	Response.write "</td><td align="+chr(34)+"right"+chr(34)+">"
    	Response.write rs("acctdesc")
    	Response.write "</td><td align="+chr(34)+"right"+chr(34)+">"
    	Response.write rs("balance")
    	Response.write "</td></tr>"
          rs.movenext
       wend
       rs.close
       set rs=nothing
    
       if c=0 then
           response.write "<P>Record not found for major="+cstr(majvalue)+" and minor="+cstr(minvalue)+". TRY Again"
       end if
    
    end sub
    %>
    
    
    </table>
    </BODY>
    </HTML>
  2. #2
  3. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,665
    Rep Power
    283
    First at all you have number of problems in your HTML...
    Your form gag located between </tr> and <tr> it should be inside <td></td> or outside the table In your particular case the best place it is just after body tag and close form tag just before </body>
    Each <center> tag should have </center> inside the same cell (<td>) you have open <center> and missing close or in some cases <center> inside one <td> and </center> in another <td> (<td> tag terminated <center>
    tag, but it is HTML error and not all browsers read that the same way and by the way <center> tag is outdated. The same issues you have with <font> tag... needs to be clean up.
    You have 3 subs in your code but did not call any of them...
    How you expect this page work?
    GK
    __________________________________________________ _____
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree
  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2011
    Posts
    6
    Rep Power
    0
    I removed the 1 straggler <center> that I saw. Outdated HTML also wouldnt cause the issue. There is also only 2 subs. The code at

    auckland.bauer.uh.edu/students/gl1363/a45.asp is almost identical to

    auckland.bauer.uh.edu/students/gl1363/a42.asp and that one works fine.

    When I moved the <form>, and everything in it, outside of the <% sub pass 1 %> it loads fine. Only when nested within the first sub tags does it have an issue.
  6. #4
  7. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,665
    Rep Power
    283
    Please explain how your page should work?
    1. When I requesting your page no any asp code executes just html part and opens page with 4 empty input boxes.
    2. I enter values in boxes for major, minor, sub1, sub2 and click "Submit Query" you submitted data to different page? or it is the same page at "http://auckland.bauer.uh.edu/students/gl1363/a45.asp"?

    You have
    Sub GoBackBut_OnClick
    sub pass1
    sub pass2
    3 sub's but did not call any of them...
    So, what you expect to see?
  8. #5
  9. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2011
    Posts
    6
    Rep Power
    0
    Originally Posted by gk53
    Please explain how your page should work?
    1. When I requesting your page no any asp code executes just html part and opens page with 4 empty input boxes.
    2. I enter values in boxes for major, minor, sub1, sub2 and click "Submit Query" you submitted data to different page? or it is the same page at "http://auckland.bauer.uh.edu/students/gl1363/a45.asp"?

    You have
    Sub GoBackBut_OnClick
    sub pass1
    sub pass2
    3 sub's but did not call any of them...
    So, what you expect to see?

    you are spot on. I actually fixed it this morning before I saw your post. I didnt have a stupid case switch for the passes. It does what it is supposed to now.

Similar Threads

  1. Beginner - Postcode Form Query
    By Peahead1253 in forum Microsoft Access Help
    Replies: 1
    Last Post: April 15th, 2013, 06:28 PM
  2. Is it possible to display the query results in a form
    By Nokia N93 in forum Microsoft Access Help
    Replies: 1
    Last Post: December 1st, 2010, 12:40 PM
  3. Form Bound to query -hesitant display
    By Penin in forum Microsoft Access Help
    Replies: 2
    Last Post: August 14th, 2008, 12:12 AM
  4. Display Query Results on Form via Text Box
    By tigrou in forum Microsoft Access Help
    Replies: 3
    Last Post: August 27th, 2004, 09:19 AM
  5. Display information from query to a form
    By ozzy36 in forum Microsoft Access Help
    Replies: 1
    Last Post: May 11th, 2004, 01:17 AM

IMN logo majestic logo threadwatch logo seochat tools logo