Cyd, I'm sure I must have posted links before on how to post here. The rules aren't that difficult, but you seem to be struggling with them. See
When Posting (VBA or SQL) Code please before posting again. Had you followed the instruction at
A2 we wouldn't need to be looking at this (or at least we would have had line number and error message to work with).
The problem is actually with your lines #2 & #3. This is a single line of code due to the continuation character, but the two strings are not added together as (presumably) intended because the ampersand (&) character is missing. It should read :
- Dim strSQL As String
-
strSQL = "Update [tblEmployees], Set [tblEmployees.strEmpPassword] = Me.newPsswd" & _
-
"WHERE strEmpPassword = Me.oldPsswd"
-
-
DoCmd.RunSQL strSQL
At this point you would have had a SQL failure on line #5 as the comma (,) after "[tblEmployees]" is not correct and there is no space between "Me.newPsswd" and "WHERE". "Me.newPsswrd" is also passed as a literal string within your SQL rather than passing its value and surrounding it in quotes to indicate it's a string value. There's also the matter of "[tblEmployees.strEmpPassword]" being an invalid field reference. It should probably end up something like :
- Dim strSQL As String
-
-
strSQL = "UPDATE [tblEmployees] " & _
-
"SET [strEmpPassword] = '" & Me.newPsswd & "' " & _
-
"WHERE ([strEmpPassword] = '" & Me.oldPsswd & "')"
-
Call DoCmd.RunSQL(strSQL)
NB. Notice though, the separate parts of of the problem in the VBA (on one side) and the SQL (on the other).