Solved

Updating a table using SQL

Posted on 2000-03-23
3
127 Views
Last Modified: 2010-05-02
I'm trying to update a table using the following code and keep getting an error 3144 syntax error in the update statement.  If I take the where clause out it updates all the passwords in the table.


 
SQL = "UPDATE SECURITYABS SET " _
    & "PASSWORD = '" & UCase(txtNewPW.Text) & "', " _
    & "WHERE USERNAME = '" & UCase(txtUserName.Text) & "'"

Any help would be appreciated.

Thanks.




0
Comment
Question by:TOMMYC
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
samopal earned 50 total points
ID: 2650114
SQL = "UPDATE SECURITYABS SET " _
    & "PASSWORD = '" & UCase(txtNewPW.Text) & _
    & "' WHERE USERNAME = '" & UCase(txtUserName.Text) & "'"


HTH
0
 
LVL 1

Expert Comment

by:tkuppinen
ID: 2650117
Take the the comma out

SQL = "UPDATE SECURITYABS SET " _
    & "PASSWORD = '" & UCase(txtNewPW.Text) & "'" & _
    & " WHERE USERNAME = '" & UCase(txtUserName.Text) & "'"

0
 
LVL 1

Expert Comment

by:tkuppinen
ID: 2650132
You may also want to look at using the replace function anytime you are inserting text into your db.  If there is a single quote in this string it will mess everything up.

pseudocode

Replace(textusername.text, " ' " , " '' ")

Of course you would have to take the spaces out, I just put them in to try to illustrate it more clearly.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question