Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Invalid use of '.', '!', or '()'. in query expression

Posted on 2002-06-26
3
811 Views
Last Modified: 2013-12-24
Hello and thanks in advance. I'm performing a very basic query where I'm checking a value against my db. I'm performing the following query:

<cfquery name="usercode_entry" datasource="#request.db#">
SELECT Usercode
FROM Codes
WHERE Usercode = '#Trim(FORM.Usercode)#'
</cfquery>

Some of the usercodes are formatted as such --> A.60203. I get the following error when a value such as the one above is input...

----------

ODBC Error Code = 37000 (Syntax error or access violation)

[Microsoft][ODBC Microsoft Access Driver] Invalid use of '.', '!', or '()'. in query expression 'Usercode = A.60203'.

The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (27:1) to (27:57).

-----------

This should be easy stuff but I'm genuinely stumped.

Thanks,
Peter Edd
0
Comment
Question by:peteredd
3 Comments
 
LVL 6

Expert Comment

by:dash420
ID: 7112744
which version of access you are using?
0
 
LVL 17

Expert Comment

by:anandkp
ID: 7113542
hi,

The error says
[Microsoft][ODBC Microsoft Access Driver] Invalid use of '.', '!', or '()'. in query expression 'Usercode = A.60203'.

Its giving u the errror for '.'

that means u've gotta enclose the value inside a single quote.

ie it should be UserCode='A.60203' [assuming usercode is a text field]

let me know if this helps

K'Rgds
Anand
0
 
LVL 1

Accepted Solution

by:
lpkuah earned 100 total points
ID: 7126482
Try this ->

<cfquery name="usercode_entry" datasource="#request.db#">
SELECT Usercode
FROM Codes
WHERE Usercode = '#preserveSingleQuotes(Trim(FORM.Usercode))#'
</cfquery>
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question