473,569 Members | 2,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Syntax Error missing operator

22 New Member
Hello all! I am not new to access, but new to coding (and posting). I have a database that I have created and need some help with a login form. When a user opens the database, a form pops up asking for a username and password. They can choose their name from a combobox and enter apassword into a textbox.

If the default password is entered, another forms pops up asking the user to change their password (this is where my problem comes in):

The first textbox on the Change Password form asks the user to enter a new password and the second textbox asks the user to enter the password in again to confirm it. If the information entered in both textboxes are equal, I would like to use a RunSql to update the table that holds the password information The code I am using is as follows:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSubmit_Click()
  2. Dim strSQL As String
  3.  
  4.  If txtNewPswd <> txtConfirmPswd Then
  5.     MsgBox "Passwords don't match. Please try again.", vbOKOnly
  6.    Else
  7.  If txtNewPswd = txtConfirmPswd Then
  8.     strSQL = " UPDATE tblUserDefinitions"
  9.     strSQL = strSQL & " SET Password = ' " & Me.txtConfirmPswd
  10.     strSQL = strSQL & " 'WHERE lngEmpID = '" & Me.txtlngEmpID & "';"
  11.  
  12.     DoCmd.RunSQL strSQL
  13.     MsgBox "Password change successful!", vbOKOnly
  14.  
  15.     DoCmd.OpenForm "frmLogon"
  16.     DoCmd.Close acForm, "frmPWChng", acSaveNo
  17.     End If
  18. End If
  19. End Sub
I am getting a run-time error stating that there is a syntax error (missing operator) in query expression. I am using Access 2007. Please help!
Mar 7 '08 #1
4 2321
nico5038
3,080 Recognized Expert Specialist
Add a space after the ' and before the WHERE like:
Expand|Select|Wrap|Line Numbers
  1. strSQL = strSQL & " ' WHERE lngEmpID = '" & Me.txtlngEmpID & "';"
  2.  
Nic;o)
Mar 7 '08 #2
NeoPa
32,564 Recognized Expert Moderator MVP
Also remove spaces from lines #9 (after the ') & #10 (before the '). Otherwise the password will be stored with spaces surrounding it and will never be matched.
Mar 7 '08 #3
nerd4access
22 New Member
That worked. Thank you for help. Much appreciated!
Mar 11 '08 #4
NeoPa
32,564 Recognized Expert Moderator MVP
Thank you for making the question clear & simple to answer.

Welcome to TheScripts :)
Mar 11 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

29
2477
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules" for when and how to use single quotes and double quotes in ASP? thanks! ---------------------- SQL = SQL & "WHERE '" &...
4
18039
by: dcarson | last post by:
I've read about this error in several other discussions, but still can't seem to pinpoint the problem with my code. Everything seemed to be working fine for some time, but it now tends to bomb out on me for some reason. The Summary field is pulled from a Rich Text Editor that allows HTML formatting and appears to be the culprit, but I just...
1
6857
by: Alan Murrell | last post by:
Hello, One of our web hosting clients is getting the following error when someone tried to log in form their login page: --- ODBC ERROR --- Microsoft OLE DB Provider for ODBC Drivers error '80040e14' Syntax error (missing operator) in query expression 'userid= AND password='''.
3
2654
by: kufre | last post by:
I need some fresh eyes to take a look at this code for me and let me know what it is I'm doing wrong because I keep getting all kinds of error message with this code. I've had several people help me with this code and every thing that've told me I've done but for the life of me I can't seem to get this working right. First I keep getting...
4
18207
by: khan | last post by:
getting, error, 3075 Syntax Error (Missing Operator) in query expression '8WHERE .=1' Dim TotalQty As Integer TotalQty = DLookup("", "", "=" & Forms!!)
24
22578
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double quotes? Do I need to use code to scrub each string and remove or escape the double quotes before using it in a query? The error I get is this: ...
7
6872
by: John Øllgård Jensen | last post by:
Hi Using MS Asccess 2000: In a query I'm trying to create a new field with following expression: FilmDate: Left(,4) The field "FilmNo" is another text field in the query. This is expression should return the 4 leftmost characters of the FilmNo
3
4921
by: access baby | last post by:
I hava a date parameter filter query but it shows error Syntax error missing operator in query experssion can some one please help where am i going wrong in expression SELECT copyorderdtl * from copyorderdtl where(((cr_created_date)is Null) and ((cr_statusupdt_date)=)) OR (((cr_created_date) is not null and (cr_statusupdt_Date)=));
4
14990
by: thebarefootnation | last post by:
Hi I have the following error message "Syntax Error (missing operator) in query expression" occurring when I am trying to update combo box within a form. My code is: Dim strSQL As String
3
1522
by: willo | last post by:
Greetings all, I have run into a small problem with my understanding of some C++ language syntax, and seek some clarification. Below is a condensed version of some code I'm having difficulty with: =============================================================== #include <cstddef// size_t
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.