Solved

Updating a table using SQL

Posted on 2000-03-23
3
128 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: 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

Title # Comments Views Activity
Adding to a VBA? 6 90
Automatic Email Reminder 4 94
VBA - If Bookmark = "XXBOOKMARKXX" then 15 66
Excel Macro update each line based on another worksheet 2 55
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

732 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