PDA

View Full Version : set user and groups permissions in access


Tim G
03-07-02, 05:49
When I want to know if a certain table is in a database, I have to access the system table MsysObjects. This table is set to be having no read permissions. In access you can change these permissions in "Tool - Security ..." But how can I change this in a VB-program?:confused:

annavp
03-08-02, 08:52
I wouldn't query the system table. Access has it's own tools to list tables and change their properties. The example below is a procedure I use to reconnect Linked tables to a database which path is passed to the function. You need to add a reference to microsoft ADO ext. 2.5 for DDL and security.

Public Sub LinkTables(strConnect As String)

Dim catTables As New ADOX.Catalog
Dim tblTable As New ADOX.Table

On Error GoTo ErrorHandler

Set catTables.ActiveConnection = CurrentProject.Connection

For Each tblTable In catTables.Tables
If tblTable.Type = "LINK" Then
tblTable.Properties("Jet OLEDB:Link Datasource").Value = strConnect
tblTable.Properties("Jet OLEDB:Table Hidden In Access").Value = True
End If
Next tblTable

Set catTables = Nothing
Set tblTable = Nothing
Set rstParameter = Nothing

Exit Sub
ErrorHandler:
msgbox "Error: " err.description
DoCmd.Quit
End Sub

If you need more info
let me know

anna

Tim G
03-08-02, 09:07
Thanks for the help, Anna...

I knew it was possible to acces a tablename with ADOX.
I used following code :

cat.ActiveConnection = currentConnection
For i = 0 To cat.Tables.Count - 1
If cat.Tables(i) = "SearchedTableName" Then ....
....

But for some strange reason I don't want to use ADOX, and I'm curious if it's possible with ADODB.

annavp
03-08-02, 10:13
To tell you the truth, I have given up searching for a solution in ADODB. I haven't found any way to refer to a table and change in properties using ADO.

If you find a solution, let me know!!!

anna