473,413 Members | 1,705 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,413 software developers and data experts.

Can someone tell me what is wrong with the syntax of this WHERE clause?

MLH
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?
Nov 13 '05 #1
6 1311
you've got 3 '(' and 2 ')'

try removing a '(', ie.

WHERE ((tblVehicleJobs.SerialNum) Like
[Forms]![frmLookUpAvehicle]![F*irstCharOfVIN] & '*') ;

Nov 13 '05 #2
On Mon, 11 Jul 2005 14:58:35 -0400, MLH <CR**@NorthState.net> wrote:
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] & '*') ;


Try:

WHERE (((tblVehicleJobs.SerialNum) Like
"'" & [Forms]![frmLookUpAvehicle]![FirstCharOfVIN] & "*'") ;

Also, make sure the Form is open and accessible.

mike

Nov 13 '05 #3
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
Nov 13 '05 #4
I think QBE adds extra parentheses to make its life easier in
presenting the query in design-mode...

Nov 13 '05 #5
MLH
Couldn't have been more simple. Somehow I kept
missing it. Thanks much!
Nov 13 '05 #6
le*********@natpro.com wrote:
you've got 3 '(' and 2 ')'

try removing a '(', ie.

WHERE ((tblVehicleJobs.SerialNum) Like
[Forms]![frmLookUpAvehicle]![F*irstCharOfVIN] & '*') ;


For gawd's sake remove all the brackets, Access puts too many in there
in the first place.

If you do end up with multiple criteria and need a lot of brackets and
get stuck, paste the SQL into something like ConTEXT
(http://www.context.cx/) and set the file type to SQL for syntax
highlighting, when you put the cursor onto an open bracket it will
highlight it and also the closing bracket.

--
[OO=00=OO]
Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: bolidev | last post by:
I'm new to SQL and can't figure out how to update my table (StoreItemStatus) that contains the current status for items in each store (STORE_KEY, ITEM_KEY, STATUS,...). I get updated status info...
15
by: M.Siler | last post by:
<HTML> <HEAD> <TITLE></TITLE> <SCRIPT> <!-- var factor_val = new Array(8,7) factor_val = 68.8 factor_val = 55
6
by: George Styles | last post by:
Hi, I am trying to work out what a block of C++ does, but I am having trouble understanding the syntax. I know Delphi well, so am happy with objects etc, its just this syntax I dont understand. ...
2
by: sunny076 | last post by:
Hi, I am confused with the syntax for NOT in MYSQL where clause and wonder if an expert in MYSQL can enlighten me. There are possibly two places NOT can go in: select * from employee_data...
20
by: nicolas.riesch | last post by:
I try to understand strict aliasing rules that are in the C Standard. As gcc applies these rules by default, I just want to be sure to understand fully this issue. For questions (1), (2) and...
5
by: JIM.H. | last post by:
Hello, I am trying to send Where clause as a parameter. Here is the detail: Select statment: // sqlSelectCommand1 // this.sqlSelectCommand1.CommandText = "SELECT * " + " FROM myTable " + "...
11
by: Frankie | last post by:
Hello: New user here...first post to group. I'm getting an SQL syntax error when I try to run the following query: $query = sprintf("SELECT itemNumber, entryDate, modifyDate, thumbnailURL,...
4
by: tasmontique | last post by:
Hello everyone, I keep getting a syntax error in my update statement. The only thing that I notice is that although the columns in my table have the same name as the fields on the form the...
3
by: bilbo | last post by:
Can anybody help me understand why I get the error "Syntax error in CONSTRAINT clause"? I get it in Access 2003 and Access 2007. Both are clean installs with no add-ins Running this code in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.