| | |
Can someone help me solve this visual basic 6.0 / SQL statement error I am getting?
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Feb 2009
Posts: 3
Reputation:
Solved Threads: 0
Can someone help me solve this visual basic 6.0 / SQL statement error I am getting?
0
#1 Mar 18th, 2009
I am running the following Update Query in my program and I am encountering the following Error:
Run-time error '2147217900 (80040e14)':
Syntax error in UPDATE statement
Here is the code i am running
My module contains the following code:
Public UserName As String
Public UpdatePassword As String
Public rsUpdateUserQuery As Recordset
Public Sub runUpdateUserQuery()
Set rsUpdateUserQuery = New ADODB.Recordset
rsUpdateUserQuery.Open sqlUpdateUserQuery, cnConnection, adOpenDynamic
End Sub
This is the procedure that is causing the error above, I am trying to update the User's Passwords in my database. I use a similar UPDATE statement for all other User related fields but for some reason this is the only one causing a problem. As far as I can see they are all the same. The Password and Username fields in my database are both Text data types. The program grabs the user info from the form and put it into the corresponding 'Update___' variables. These variables are then used in the UPDATE statements.
sqlUpdateUserQuery = "UPDATE tblUSERS SET Password = '" & UpdatePassword & "'" & " WHERE UserName = '" & UserName & "' "
runUpdateUserQuery
The issue always happens after executing runUpdateUserQuery.
Any help or suggestions would be greatly appreciated!
Cheers
Run-time error '2147217900 (80040e14)':
Syntax error in UPDATE statement
Here is the code i am running
My module contains the following code:
Public UserName As String
Public UpdatePassword As String
Public rsUpdateUserQuery As Recordset
Public Sub runUpdateUserQuery()
Set rsUpdateUserQuery = New ADODB.Recordset
rsUpdateUserQuery.Open sqlUpdateUserQuery, cnConnection, adOpenDynamic
End Sub
This is the procedure that is causing the error above, I am trying to update the User's Passwords in my database. I use a similar UPDATE statement for all other User related fields but for some reason this is the only one causing a problem. As far as I can see they are all the same. The Password and Username fields in my database are both Text data types. The program grabs the user info from the form and put it into the corresponding 'Update___' variables. These variables are then used in the UPDATE statements.
sqlUpdateUserQuery = "UPDATE tblUSERS SET Password = '" & UpdatePassword & "'" & " WHERE UserName = '" & UserName & "' "
runUpdateUserQuery
The issue always happens after executing runUpdateUserQuery.
Any help or suggestions would be greatly appreciated!
Cheers
Re: Can someone help me solve this visual basic 6.0 / SQL statement error I am gettin
0
#2 Mar 19th, 2009
JUST TRY THIS.
sqlUpdateUserQuery = "SELECT * FROM tblUSERS WHERE UserName = '" & UserName & "' "
Set rsUpdateUserQuery = New ADODB.Recordset
rsUpdateUserQuery.Open sqlUpdateUserQuery, cnConnection, adOpenDynamic
With rsUpdateUserQuery
.Fields("FieldName")=txtName.Text
.Fields(FieldName2")=txtName2.Text
.Update
End With
sqlUpdateUserQuery = "SELECT * FROM tblUSERS WHERE UserName = '" & UserName & "' "
Set rsUpdateUserQuery = New ADODB.Recordset
rsUpdateUserQuery.Open sqlUpdateUserQuery, cnConnection, adOpenDynamic
With rsUpdateUserQuery
.Fields("FieldName")=txtName.Text
.Fields(FieldName2")=txtName2.Text
.Update
End With
•
•
Join Date: Feb 2009
Posts: 3
Reputation:
Solved Threads: 0
Re: Can someone help me solve this visual basic 6.0 / SQL statement error I am getting?
0
#3 Mar 19th, 2009
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Problem in resizing forms........
- Next Thread: sql text search
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





