Solved

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

Posted on 2002-06-26
3
842 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
[X]
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
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

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

739 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