?
Solved

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

Posted on 2002-06-26
3
Medium Priority
?
1,008 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 400 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

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 …
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

807 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