Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use 'UPDATE' in MSAccess

Status
Not open for further replies.

mazdaman

Programmer
Oct 17, 2003
55
GB
How do I trigger the following SQL statement from a graphic 'update' button on an ASP page

UPDATE addressbook INNER JOIN newaddress ON addressbook.PersonID = newaddress.PersonID SET newaddress.add1 = addressbook.add1

Any ideas ? Cheers chaps
 
If it is inside an HTML form then you probably want to do it when the form is submitted.
 
when you hit the submit button, the form can either submit to itself or to another where you set up the

sql="UPDATE addressbook INNER JOIN newaddress ON addressbook.PersonID = newaddress.PersonID SET newaddress.add1 = addressbook.add1"

conn.execute(sql)

where conn is your connection string
 
Code:
<html>
 <head>
</head>
<body>


  <form method="post" action="<%=Request.servervariables("script_name")%>">

  <!-- form inputs -->

   <input type="image" name="update" src="update.gif" alt-"Update"> 
' form image has x and y attributes so when 
          ' requesting value see if x value was submitted
  </form> 

<%
 If Request.Form("update.x") <> "" Then
   strSQL="UPDATE addressbook INNER JOIN newaddress ON addressbook.PersonID = newaddress.PersonID SET newaddress.add1 = addressbook.add1"

conn.execute(sql)
  

 Response.Write "Address Updated!"


  End If
%>
</body>
</html>
 
Hi bslintx .. just trying out your idea and get back to you - its the weekend !!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top