Access MSysObjects Read Permission

1,840 views
Skip to first unread message

Qatan

unread,
Mar 19, 2013, 3:18:44 AM3/19/13
to harbou...@googlegroups.com
Hello all ,
 
Does anyone know how to programatically change the read permission of an Access (aka MDB) MSysObjects table info? Off course it should be done using Harbour...
My goal is to get the information of the local table names.
 
I suceed doing so using SQLMIX and this SQL directive: "SELECT Name FROM MSysObjects WHERE Flags=0 AND Type=1"
 
But to do so I have to open the MDB file with Access and go to tools->security->user and group permissions-> administrator permission to MSysObjects is there.

I Googled I found nothing that I could use in Harbour or I dont know how to apply VB code in Harbour...
 
I hope someone already did this and would share how to, please.
 
Thanks for any help
 
 
Qatan

Massimo Belgrano

unread,
Mar 19, 2013, 4:38:51 AM3/19/13
to harbou...@googlegroups.com
Post the vb code who works for you
Explore c:\harbour\extras\rddado\test
also serch rddado on http://www.elektrosoft.it/tutorials/Harbour-Reference-Guide/harbour-complete-functions-list.htm

(you can execute from your harbour program vbs script)


2013/3/19 Qatan <wanst...@gmail.com>

--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
 
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Massimo Belgrano
Delta Informatica S.r.l. (http://www.deltain.it/mbelgrano

Gmail

unread,
Mar 19, 2013, 10:16:11 AM3/19/13
to harbou...@googlegroups.com
Hello Massimo,
 
 
> Post the vb code who works for you
>(you can execute from your harbour program vbs script)
 
 
    First of all, thanks for answering.
    Well, I do not think it will be of much help because I feel like shooting into the dark...
 
    Look what this one says here, seems possible but I don’t know how to “transport” that to Harbour reality: http://social.msdn.microsoft.com/forums/en-US/vbgeneral/thread/7522c873-eec8-4fbf-8e30-8d60cefc7428
 
    Here some info of using MSysObjects with links to some resources: http://www.perfectparadigm.com/tip001.html
   
    Actually I don’t have much information but I know what I want. I think that’s a good start...
    Any info is welcome.
    Regards,
 
Qatan
 
 

Massimo Belgrano

unread,
Mar 19, 2013, 10:44:26 AM3/19/13
to harbou...@googlegroups.com
search system.mdb executing  
start execute
%appdata%\Microsoft\Access
Immagine in linea 1

i post so other user will help you

Dim conn As System.Data.OleDb.OleDbConnection
Dim cmdToExecute As System.Data.OleDb.OleDbCommand
'NB. Replace the data source with the one for your Access DB and replace
'the Jet OLEDB:System Database with the path to your System.mdw
conn = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\XXXXX\My Documents\db3.mdb;" & _

            "Jet OLEDB:System Database=C:\Documents and Settings\XXXXXX\Application Data\\Microsoft\Access\System.MDW")

cmdToExecute = New System.Data.OleDb.OleDbCommand()
cmdToExecute.Connection = conn
cmdToExecute.CommandType = CommandType.Text
cmdToExecute.CommandText = "GRANT SELECT ON TABLE MSysObjects TO PUBLIC"

conn.Open()
Try
    cmdToExecute.ExecuteNonQuery()
Catch ex As Exception
    MsgBox(ex.Message)
End Try

conn.Close()


2013/3/19 Gmail <wanst...@gmail.com>

--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
 
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
image.png

Gmail

unread,
Mar 20, 2013, 4:19:59 AM3/20/13
to harbou...@googlegroups.com
Hello Massimo,
 
    Here is an example of what I do in Harbour, but for this to work I need to use Access to setup the read permit to Msys Tables... (that’s what I want to automate).
    In case you try it without doing the permissions in Access you get an error...
 
------>8------
#include "simpleio.ch"
#include "hbrddsql.ch"
 
REQUEST SDDODBC, SQLMIX
 
PROCEDURE Main()
 
   SETMODE(25,80)
   SET COLOR TO 
   CLS
 
   RDDSETDEFAULT( "SQLMIX" )
   SET( _SET_DATEFORMAT, "yyyy-mm-dd" )
   ? "Connect:", RDDINFO( RDDI_CONNECT, { "ODBC", "DBQ=" + hb_DirBase() + "base.mdb;Driver={Microsoft Access Driver (*.mdb)}" } )
   ? "Use:", DBUSEAREA( .T.,, "SELECT Name AS TableName FROM MSysObjects WHERE Type = 1 AND Flags = 0 ORDER BY Name", "BASE" )
 
   ? "Alias:", ALIAS()
   ? "DB struct:", HB_VALTOEXP( DBSTRUCT() )
 
   DBGOTOP()
 
   DO WHILE !EOF()
        ? TableName
        DBSKIP()
   ENDDO
 
   INKEY(0)
   BROWSE()
 
   DBCLOSEAREA()
 
RETURN
------8<------
 
Qatan
 
Reply all
Reply to author
Forward
0 new messages