473,326 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Syntax error missing operator in query expression

This error plagues my SQL and as the error is so generic and comprises multiple lines, I have nothing to search on.

I can correct it only to have an "Syntax error in UPDATE statement."

So, sample
Error begins at TRUE and ends before the WHERE.
Expand|Select|Wrap|Line Numbers
  1. UPDATE [Inspections SHELL]
  2. SET  [Inspections SHELL].[Phase 1] = TRUE -- Toggle Yes/No on
  3. INNER JOIN [Inspections Attempt]
  4. ON ([Inspections SHELL].[Field] = [Inspections Attempt].[Field]) 
  5. AND ([Inspections SHELL].[start] = [Inspections Attempt].[date])
  6. WHERE ([Inspections Attempt].[Phase] = 1);
  7.  

This is a reduction of the following code

Expand|Select|Wrap|Line Numbers
  1. UPDATE [Inspections SHELL]
  2. SET  [Inspections SHELL].[Phase 1] = IIf([Inspections Attempt]![Phase]=1,True,False), --Toggle Phase 1 if Phase = 1
  3.      [Inspections SHELL].[Phase 2] = IIf([Inspections Attempt]![Phase]=2,True,False), --Toggle Phase 2 if Phase = 2
  4.      [Inspections SHELL].[18X Day] = IIf([Inspections Attempt]![Phase]=0,True,False), --Toggle 180 day if Phase = 0
  5.     /* Toggle appropriate state if note indicates */
  6.      [Inspections Shell].[Acceptence] = IIF(instr([Inspections Shell].[Notes], "Accept") > 0, true, false),
  7.      [Inspections Shell].[Special] = IIF(instr([Inspections Shell].[Notes], "Spec") > 0, true, false),    
  8.      [Inspections Shell].[CC] = IIF(instr([Inspections Shell].[Notes], "CC") > 0, true, false)    ,
  9.      [Inspections Shell].[90 Day] = IIF(instr([Inspections Shell].[Notes], "90") > 0, true, false),
  10.      [Inspections Shell].[1 Year] = IIF(instr([Inspections Shell].[Notes], "1 year") > 0, true, false),        
  11.      [Inspections Shell].[2 Year] = IIF(instr([Inspections Shell].[Notes], "2 year") > 0, true, false),    
  12.      [Inspections Shell].[W&B] = IIF(instr([Inspections Shell].[Notes], "&") > 0, true, false)    
  13. FROM [Inspection SHELL] 
  14. INNER JOIN [Inspections Attempt]
  15. ON ([Inspections SHELL].[Field] = [Inspections Attempt].[Field]) 
  16. AND ([Inspections SHELL].[start] = [Inspections Attempt].[date]);
  17.  
  18. Which has the same series of errors.
  19.  
As a supplement, most update queries that I get to "work" will explode my database (going from 7 MB to 200 MB with a creation of 20,000+ null records). The only update that has worked has used bare minimum syntax, so the actual question may be "what am I missing with update syntax?"
Mar 15 '11 #1
4 2686
ADezii
8,834 Expert 8TB
Try a change in Syntax, specifically the location of the SET Statement, as in:
Expand|Select|Wrap|Line Numbers
  1. UPDATE [Inspections SHELL]
  2. INNER JOIN [Inspections Attempt]
  3. ON ([Inspections SHELL].[Field] = [Inspections Attempt].[Field])
  4. AND ([Inspections SHELL].[start] = [Inspections Attempt].[date])
  5. SET [Inspections SHELL].[Phase 1] = True
  6. WHERE [Inspections Attempt].[Phase] = 1;
Mar 15 '11 #2
That gets rid of the syntax problem... now to test it; but hat is supremely annoying, I found the relocation of the join in a forum but I got an error in UPDATE.

Will this method work for the mass update?

EDIT:

It doesn't join properly.

Each table has identical fields being inner joined, but I'm only getting 65 records returned of 312, and none of them have [Phase 1] = True.
Mar 15 '11 #3
ADezii
8,834 Expert 8TB
@Jeff - Can you Upload a Copy of the Database with a Minimal number of Records, stripped of any Personal Info, of course? This way, we can see the problem first hand.
Mar 15 '11 #4
I'll see what I can do.

Going to have to use an update query to scramble some of the data to enforce privacy.

Expand|Select|Wrap|Line Numbers
  1. UPDATE table
  2. SET table.Field = Right([table]![Field],1) & Mid([table]![Field],2,2) & Left([table![Field], 3);
  3.  
Should change all records such that ABCD would become DBCABC right? Because it's not doing -anything-, and I cannot submit it with the current fields as is, and they have to be all updated in the same format to preserve data relationship.
Mar 15 '11 #5

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

Similar topics

0
by: alexz | last post by:
valuA = (request.form("toadd")) If valuA = "" then SQL = "UPDATE CourseReg SET attended='Active' WHERE ID IN("&request.form("toadd")&")" Set RS = MyConn.Execute(SQL) End If MyConn.Close Set...
29
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"...
4
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...
3
by: Lumpierbritches | last post by:
Syntax Error (missing operator) in query expression =BLANK'S MOLLIE-PRINCE BRUISER-3/14/2004-03 AnimalID is correct. I'm trying to open with a command button or double click the frmAnimal from a...
4
by: khan | last post by:
getting, error, 3075 Syntax Error (Missing Operator) in query expression '8WHERE .=1' Dim TotalQty As Integer TotalQty = DLookup("", "", "=" & Forms!!)
1
by: Justin R | last post by:
Hey I am really stuck and can't figure out what is wrong here is the code line and surrounding code, if anyone can help i would appreciate it. Thanks This first line is the line that has a problem...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.