Use field on web page as MS Access input parameter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • katwheels
    New Member
    • Nov 2009
    • 1

    Use field on web page as MS Access input parameter

    I need to convert a data element from a web page table into an MS Access input parameter and then run another MS Access query.

    I have an ASP web page that generates an MS Access query and creates a table on a webpage. This code generates the field1 value on the original table.
    Code:
    If Request.querystring("mode") = "table1" then userID = Clng(Session("userID"))
         Set rsViewProfile = Server.CreateObject("ADODB.Recordset")  
         strSQL = "SELECT [username], [field1], [field2], [field3], [ID] FROM table1 WHERE ID=" & UserID
         rsViewProfile.Open strSQL, adoCon
    
    Do While Not rsViewProfile.EOF 
    Response.Write (rsViewProfile("username"))
    
        Response.Write ("</center></td><td><center><a href='detail.asp?mode=specificinfo'")
        Response.Write (rsViewProfile("field1"))
        Response.Write (">")
        Response.Write (rsViewProfile("field1"))	
    
        Response.Write ("</center></td><td><center>")
        Response.Write (rsViewProfile("field2"))	
    
        Response.Write ("</center></td><td><center>")
        Response.Write (rsViewProfile("field3"))		
        Response.Write ("</center></td></tr>")
    
    rsViewProfile.MoveNext
        Loop
        Response.Write ("</table>")
        Set rsViewProfile = Nothing
        Set adoCon = Nothing
    End If
    I now need to take this field1 table element, convert it to a MS Access input parameter and run a new MS Access query.
    Code:
    strSQL = "SELECT [username], [field1], [field2], [field3], [ID] FROM table WHERE ID=" & UserID AND (((field1)= [@field1]))
    In other words, I'm drilling down into the data. The first table creates a list of the customer's businesses. I want to click on the name of one of those businesses to generate a table with details for that specific business.

    Any help, sample code would be greatly, greatly appreciated!!
  • jeffstl
    Recognized Expert Contributor
    • Feb 2008
    • 432

    #2
    You should be able to just?

    Code:
    Response.Write ("</center></td><td><center><a href='detail.asp?mode=specificinfo&fieldLookup=rsViewProfile("field1")'")
    Then on the detail.asp page take the value of fieldLookup for your sql string

    Comment

    Working...