Syntax error in query expression.

  • Thread starter Thread starter John Michael
  • Start date Start date
J

John Michael

I am trying to run this SQL and access keeps giving me an error.
Syntax Error "Missing Operator" in query expression '((Iou_paid = True) 0R
(Iou_amount = 0))'

Dim strDEL_SQL As String
strDEL_SQL = "DELETE * FROM [I Owe You] WHERE ((Iou_paid = True) 0R
(Iou_amount = 0))"
DoCmd.RunSQL strDEL_SQL

The table name is [I Owe You]

It worked when I just had:
Dim strDEL_SQL As String
strDEL_SQL = "DELETE * FROM [I Owe You] WHERE Iou_paid = True"
DoCmd.RunSQL strDEL_SQL

and quit working when I added the Iou_amount = 0 part.

I looked at it in the query builder and it is like this.
DELETE [I Owe You].Dancer_id, [I Owe You].Iou_date, [I Owe You].Iou_amount,
[I Owe You].Iou_paid
FROM [I Owe You]
WHERE ((([I Owe You].Iou_amount)=0)) OR ((([I Owe You].Iou_paid)=True));

Any Ideas
Thanks in advance.
John Michael
 
Hi John,

You have a typo in strDEL_SQL. You used a zero instead of the letter "O", when you typed out the
word "0R".


Tom
_____________________________________________


I am trying to run this SQL and access keeps giving me an error.
Syntax Error "Missing Operator" in query expression '((Iou_paid = True) 0R
(Iou_amount = 0))'

Dim strDEL_SQL As String
strDEL_SQL = "DELETE * FROM [I Owe You] WHERE ((Iou_paid = True) 0R
(Iou_amount = 0))"
DoCmd.RunSQL strDEL_SQL

The table name is [I Owe You]

It worked when I just had:
Dim strDEL_SQL As String
strDEL_SQL = "DELETE * FROM [I Owe You] WHERE Iou_paid = True"
DoCmd.RunSQL strDEL_SQL

and quit working when I added the Iou_amount = 0 part.

I looked at it in the query builder and it is like this.
DELETE [I Owe You].Dancer_id, [I Owe You].Iou_date, [I Owe You].Iou_amount,
[I Owe You].Iou_paid
FROM [I Owe You]
WHERE ((([I Owe You].Iou_amount)=0)) OR ((([I Owe You].Iou_paid)=True));

Any Ideas
Thanks in advance.
John Michael
 
Back
Top