ACC 2002 - sql ADD USER TO error

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.
 
E

Eric Butts [MSFT]

Hi,

Have you tried this method:

http://support.microsoft.com/default.aspx?scid=KB;EN-US;210418

Note: it uses DAO instead of ADOX. If working with security DAO is the
preferred method, there are numerous issues with ADOX and security.

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights


--------------------
| Content-Class: urn:content-classes:message
| From: "Tony_VBACoder" <[email protected]>
| Sender: "Tony_VBACoder" <[email protected]>
| Subject: ACC 2002 - sql ADD USER TO error
| Date: Thu, 24 Jun 2004 09:16:08 -0700
| Lines: 26
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcRaBo6C9vPbEJ9VSqSpdKEXnFClQQ==
| Newsgroups: microsoft.public.access.security
| Path: cpmsftngxa10.phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.security:11681
| NNTP-Posting-Host: tk2msftngxa12.phx.gbl 10.40.1.164
| X-Tomcat-NG: microsoft.public.access.security
|
| 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.
|
 

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