run-time error'-2147217900(8004e14)': syntax error in FROM clause

T

taefeut

Anybody there? Please help. I am using Access Version: 2003 (11.0)
Below is the code that I'm having the above error message with. I'm trying
to create a recordset from an access table. I plan on using the recordset in
some codes to follow which is not included in this pasted codes (trying to
create something similar to a cursor in plsql). Also, after I get my
recordset, how do I retrieve the current record?


Private Sub Form_Current()

Dim db As ADODB.Connection
Dim UserGroupRst As ADODB.Recordset
Dim SqlStmt As String


Set db = CurrentProject.Connection

Set UserGroupRst = New ADODB.Recordset


SqlStmt = "SELECT DISTINCTROW AdministerSecurity.GroupName " & _
"FROM AdministerSecurity " & _
"Where AdministerSecurity.UserId = " & CurrentUser



UserGroupRst.Open SqlStmt, db, adOpenStatic, adLockReadOnly, adCmdTable

UserGroupRst.Close
db.Close

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top