Link to home
Start Free TrialLog in
Avatar of peteredd
peteredd

asked on

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

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
Avatar of dash420
dash420
Flag of Canada image

which version of access you are using?
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
ASKER CERTIFIED SOLUTION
Avatar of lpkuah
lpkuah

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial