var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: SQL syntax
I am getting this error on execution of a piece of code:
The select statement includes a reserved word or an argument that is misspelled or missing or the punctuation is incorrect.
Here is the sql:
strSQL = "SELECT tblEvaluation.EvaluatorMgr, Count(tblEvaluation.EvaluatorMgr) AS MyCount, " & _
"tblEvaluation.ECycle , tblEvaluation.Month, tblEvaluation.Year, " & _
"FROM tblEvaluation " & _
If MyCount >= 2 Then
MsgBox "This person already evaluated a member"
Thanks for your assistance
have you viewed the SQL being sent to the sql parser, either set a break point after assigning the value to strSQL or do msgbox strsql
on the face of it the SQL looks OK
Buit I've a sneaking suspiscion that you need to rewrite it as you cannot use an aggregation with other columns unless they aredefined in a having clause
if you are not using the other columns Id be tempted to rewrite the SQL so that
strSQL = "SELECT Count(tblEvaluation.EvaluatorMgr) AS MyCount" &_
" FROM tblEvaluation" & _
" WHERE tblEvaluation.EvaluatorMgr=[txtRandomMgr];"
For starters, you've got a comma between the last field in the SELECT clause and the word FROM, which is likely the cause of the error. Secondly, you can't use RunSQL for a SELECT query, only action queries. You'll need to open a recordset or switch to DCount. Thirdly, presuming [txtRandomMgr] is a form control, it needs to be concatenated in:
"WHERE (((tblEvaluation.EvaluatorMgr)=" & [txtRandomMgr] & "));"
presuming it's a numeric field. Add single quotes if it's text:
"WHERE (((tblEvaluation.EvaluatorMgr)='" & [txtRandomMgr] & "'));"
Agreed with pbaldy... and Lollers at repeating the Access mistake of (((including) unnecessary brackets))!
You can use "WHERE tblEvaluation.EvaluatorMgr=" & [txtRandomMgr] just as effectively.
Owner and Manager of
. , Microsoft Access Development Specialists CypherBYTE
Microsoft Access . MCP
And all around nice guy! "Heck it's something understood by accountants ... so it can't be 'that' difficult..."
"...teach a man to code and he'll be frustrated for life! "
on secoind glance you may need to encapsulate the [txtRandomMgr] with either single or double quotes IF that field/colu,n is a text/string value.....
& chr(34) & [txtRandomMgr] & chr(34)