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
<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
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.