MLH <CR**@NorthState.net> wrote in
news:08********************************@4ax.com:
If I cut it from the rest of the SQL, the query runs fine. But
when I leave the following WHERE clause in there, Access tells me
there's a missing Operator?
WHERE (((tblVehicleJobs.SerialNum) Like
[Forms]![frmLookUpAvehicle]![FirstCharOfVIN] & '*') ;
Any idea what missing operator Access is talking about?
I'm not sure why you're using single quotes, but it shouldn't make a
difference, but you're also missing a closing parenthesis.
WHERE (((tblVehicleJobs.SerialNum) Like
[Forms]![frmLookUpAvehicle]![FirstCharOfVIN] & "*"))
Of course, I'm not sure why the QBE isn't putting that in -- when I
type a similar criterion based on LIKE [form control] & "*", it
comes out with correct parentheses in SQL view.
On the other hand, when I'm writing SQL directly (instead of using
the QBE), I remove *all* the parentheses, and only add them in to
clarify the order of any AND and OR statements in the WHERE
criteria.
(X AND Y) OR Z vs. X AND (Y OR Z)
It is very seldom that the extra parentheses that the Access QBE
puts in are required (though it could be that the query optimizer
works more efficiently if they are already there).
The one area that I leave the parens alone is in the JOIN syntax,
which I find too baffling to muck around int -- I let the QBE write
it and leave it alone!
--
David W. Fenton
http://www.bway.net/~dfenton
dfenton at bway dot net
http://www.bway.net/~dfassoc