Forum Moderators: open
Syntax error in FROM clause
on the line:
ChkUserNameRS.Open ChkUserNameSQLstr
Here is the snipet of code:
Set ChkUserNameRS = Server.CreateObject("ADODB.Recordset")
Set ChkUserNameRS.ActiveConnection = my_Conn
ChkUserNameSQLstr = "SELECT Count(Username) as UsernameCount FROM User WHERE Username='" & FrmUser & "'"
ChkUserNameRS.Open ChkUserNameSQLstr
I have used a response.write to see the full query the code tries to run. I have copied and paste this into access and it runs fine. I'm completely lost.
Any help is appreciated.
Chris.
Instead try it like this to ensure that object names are recognised as objects rather than keywords etc;
ChkUserNameSQLstr = "SELECT COUNT( [Username] ) as UsernameCount FROM [User] WHERE [Username]='" & FrmUser & "'"
- Tony
Since I just couldn't rename the db field, I had to modify my query to use an "absolute" field name, like this:
WHERE [TableName]![Language]
instead of
WHERE Language
I nearly went nuts to find the cause of the error, but the square brackets saved my day.
I don't know asp nor ever use access, but I'm pretty sure what you need is:
select blah, count(blah2) from blah3 where blah4=blah5 group by blah;
If you are in fact trying to count the groups of blah.
<edit>sp</edit>
<edit>sp2, boy do I feel sleepy</sp>