Connecting Tech Pros Worldwide Help | Site Map

Use field on web page as MS Access input parameter

Newbie
 
Join Date: Nov 2009
Posts: 1
#1: 1 Week Ago
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.

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.

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's Avatar
Expert
 
Join Date: Feb 2008
Posts: 410
#2: 21 Hours Ago

re: Use field on web page as MS Access input parameter


You should be able to just?

Expand|Select|Wrap|Line Numbers
  1. 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
Reply

Tags
access, asp, parameter, query, sql