Results 1 to 3 of 3
  1. #1
    xfp39024 is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2012
    Posts
    15

    How to issue a GRANT statement from a macro

    I have a situation where I need to issue a GRANT statement from a VB program interacting with an MS-Access database. So far I have:



    Code:
    Dim myAccess as New Access.Application
    myAccess.OpenCurrentDatabase("myAccess.mdb")
    myAccess.DoCmd.RunSQL("GRANT SELECT ON TABLE MSysObjects TO PUBLIC")
    (This is to allow me to ready the MSysObjects table from vb.net, which otherwise fails with a permissions error.)

    But this fails on the last line with the error: Invalid SQL Statement: Expected DELETE, INSERT, PROCEDURE, SELECT or UPDATE

    So, the question is, how can I run the GRANT statement?

  2. #2
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    visual basic does not have the GRANT statement available in legacy environments, I don't believe.

    but read this: http://www.vb6.us/tutorials/using-je...ts#daosecurity under the

    "Object Permissions" section.

  3. #3
    xfp39024 is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2012
    Posts
    15
    Hmmm...interesting, though I cannot find a way to get to the Permissions property mentioned in the article.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 05-05-2012, 02:34 AM
  2. Replies: 7
    Last Post: 08-17-2011, 01:49 PM
  3. Replies: 0
    Last Post: 01-12-2011, 12:43 PM
  4. Replies: 0
    Last Post: 07-13-2010, 07:45 AM
  5. If statement Issue????
    By graviz in forum Programming
    Replies: 1
    Last Post: 09-25-2009, 10:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums