hi.im facing an error that says 'syntax error in FROM clause'.i dont know where i went wrong because it used to run smoothly.from my research about this error,it seems each solution is unique,it doesnt relate to what im doing.can anyone please help?here are my codes:

Private Sub Cmd_Login_Click()
Adodc1.RecordSource = "SELECT * FROM User Where user_name='" & Txt_Name.Text & "'"
Adodc1.Recordset.Requery
Adodc1.Refresh

If Adodc1.Recordset.RecordCount = 0 Then 'user doesnt exist
    MsgBox "Bad Username! Try again."
    Exit Sub 'so that it won't move on checking the password
End If

'user exist,check password
If Adodc1.Recordset.Fields("password") = Txt_Pass.Text Then
    If Adodc1.Recordset.Fields("user_status") = "admin" Then 'check user status
    'current_user = Adodc1.Recordset.Fields("user_name").Value
    MsgBox "Login Successful!"
    Unload Me
    A2_AdminMain.Show 'login Admin Page
    Else
    current_user = Adodc1.Recordset.Fields("user_name").Value
    MsgBox "Login Successful!"
    Unload Me
    A2_UserMain.Show 'login user page
    End If

Else 'Wrong Password
    MsgBox "Wrong password. Try again."
End If

End Sub

Try this:

Adodc1.RecordSource = "SELECT * FROM [User] Where user_name='" & Txt_Name.Text & "'"

If that doesn't work, check the table name 'User' is correct in your database.

i got it.i change the name of my table from: 'User'->'Table_user' in my database.
it works fine.why does this happen?is the keyword 'user' a special case?

yup! we can't use user as table name in database because it's already exist.

i think it was used to store the data about users of database development software (such as sql server) , for example: login name that we use to login to the sql server..

i faced the same problem 2.using the name 'user' as a table name doesnt work.i tried searching for ways to overcome but failed.n now i know why.thanx evryone;)

This question has already been answered. Start a new discussion instead.