T
Tony_VBACoder
In my Access 2002 application, I am trying to issue the
following SQL statement to add a User to the built in
Access Security Group "Read-Only Users" and I am getting
the error "Run-time error '-2147467259 (80004005)'
Invalid SQL syntax - related tokens did not match. Jet
expected GRANT...TO, REVOKE...FROM, ADD...TO, or
DROP...FROM.":
**********************************************************
Public Sub AssignUserToGroup(sUserName As String, sGroup
As String)
Dim conDatabase As ADODB.Connection
Dim sSQL As String
' This will assign a User to a particular group
Set conDatabase = Application.CurrentProject.Connection
sSQL = "ADD USER " & sUserName & " TO " & sGroup
conDatabase.Execute sSQL
**********************************************************
I don't get the error if I try to add the user
to "Users", "Admins", "Operators", "SuperUser". It is only
when I try to add the user to "Read-Only Users". If I use
the Tools/Security/User and Group Accounts, I have no
problem adding this user to the "Read-Only Users" group.
following SQL statement to add a User to the built in
Access Security Group "Read-Only Users" and I am getting
the error "Run-time error '-2147467259 (80004005)'
Invalid SQL syntax - related tokens did not match. Jet
expected GRANT...TO, REVOKE...FROM, ADD...TO, or
DROP...FROM.":
**********************************************************
Public Sub AssignUserToGroup(sUserName As String, sGroup
As String)
Dim conDatabase As ADODB.Connection
Dim sSQL As String
' This will assign a User to a particular group
Set conDatabase = Application.CurrentProject.Connection
sSQL = "ADD USER " & sUserName & " TO " & sGroup
conDatabase.Execute sSQL
**********************************************************
I don't get the error if I try to add the user
to "Users", "Admins", "Operators", "SuperUser". It is only
when I try to add the user to "Read-Only Users". If I use
the Tools/Security/User and Group Accounts, I have no
problem adding this user to the "Read-Only Users" group.