Update Access Database

Results 1 to 2 of 2

Thread: Update Access Database

  1. #1
    Join Date
    Dec 1969

    Default Update Access Database

    Please help! I have an Access phonelist database. The table I am accessing is called List and the only fields are firstname, lastname and extension. This is what I&#039m trying to make happen: The user opens an HTML form and enters the name of the person who&#039s information they want to update. The next form gets populated with that person&#039s information. The user changes the information on that form and, on submit, the form calls update.asp (below). Update.asp should make the changes to the database, but I get this error:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e14&#039 <BR><BR>[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement. <BR><BR>/phonelist/update.asp, line 19<BR>(Line 19 is conn.Execute(sql)<BR><BR>I did an INSERT SQL statement on another page using the same type of syntax and it works fine. Please tell me what&#039s wrong!<BR><BR>&#060;%@ Language=VBScript %&#062;<BR><BR>&#060;% <BR>lastname=Request.Form("lastname")<BR>firstname =Request.Form("firstname")<BR>extension=Request.Fo rm("extension")<BR><BR>Dim conn<BR>Set conn = Server.CreateObject("ADODB.Connection")<BR>conn.Op en "PhoneList"<BR> <BR>Dim sql <BR>sql="UPDATE List " &_<BR>"FIELDS(lastname,firstname,extension) " &_<BR>" VALUES (&#039"& lastname &"&#039, " &_<BR>"&#039"& firstname &"&#039,&#039"& extension &"&#039) " &_<BR>"WHERE firstname=&#039"& firstname &"&#039"<BR><BR>conn.Execute(sql)<BR>conn.Close<BR >%&#062;<BR><BR>When I remove conn.Execute I don&#039t get an error, however, it is still not updating the database! I also tried a response.write without the conn.Execute and it shows all of the data correctly, it just isn&#039t posting it to the database.<BR><BR>I would appreciate anyone&#039s thoughts, as I have been trying to figure this out for several days and am getting to the end of my rope!<BR><BR>Thanks!

  2. #2
    Join Date
    Dec 1969

    Default RE: Update Access Database

    This is the syntax for an update statement. Fill in your variables after the equals signs.<BR><BR>Update List<BR>Set LastName = LastName, FirstName = FirstName, Ext. = Ext.<BR>Where FirstName = FirstName

Posting Permissions

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