Re: Security restrictions and table linking
- From: "John" <noemail@xxxxxxxxxxxxx>
- Date: Mon, 04 Sep 2006 17:37:17 GMT
Rick, That's an excellent idea; Never crossed through my mind...Below is the
code I came up with (works beautifully). The account I'm using for the
RefreshLinkAs function is a specific account that has 'Open/Run'
permissions. However I didn't realize that by removing the 'Open/Run'
permissions for the standard user I'm also removing the ability to run SQL
statements or open the linked tables ;-( (I'm a missing/doing something
else wrong)
Public Function RefreshLinksAs(strFileName As String, AsUsername As String,
Password As String) As Boolean
Dim wrk As DAO.Workspace
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Set wrk = DAO.DBEngine.CreateWorkspace("", AsUsername , Password,
dbUseJet)
Set dbs = wrk.OpenDatabase(CurrentDb.Name)
For Each tdf In dbs.TableDefs
If Len(tdf.Connect) > 0 Then
tdf.Connect = ";DATABASE=" & strFileName
Err = 0
On Error Resume Next
tdf.RefreshLink ' Relink the table.
If Err <> 0 Then
RefreshLinksAs = False
Exit Function
End If
End If
Next tdf
RefreshLinksAs = True ' Relinking complete.
dbs.Close
wrk.Close
Set dbs = Nothing
Set wrk = Nothing
End Function
"Rick Brandt" <rickbrandt2@xxxxxxxxxxx> wrote in message
news:7HTKg.5426$tU.5173@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"John" <noemail@xxxxxxxxxxxxx> wrote in message
news:SkNKg.43929$5i3.31414@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all! I have a backend that is secured and a frontend (mde) that has
some vba code that re-links the tables to the backend. My question: Is
there any way I can stop a read-only users to open the backend directly?
I tried removing the "Open/Run" permission to the database object for
this user in the backend, but doing that does not allow the user to do
the re-linking when he/she logs on through the frontend.
What I'm trying to do is to avoid the read-only user from seeing the flat
data, as he/she might copy the bulk data outside the application.
Thanks for any ideas or suggestions.
Your code for re-linking can open a new workspace where you specify a
different user (one with more permissions). You have to provide the
username and password in your code to do this so you would want to
distribute only an MDE so the code cannot be viewed.
I'm sorry, but off-hand I don't know the specific code for doing this.
You should be able to find it searching the help file or the web though.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
.
- Follow-Ups:
- Re: Security restrictions and table linking
- From: Rick Brandt
- Re: Security restrictions and table linking
- References:
- Security restrictions and table linking
- From: John
- Re: Security restrictions and table linking
- From: Rick Brandt
- Security restrictions and table linking
- Prev by Date: Re: Security restrictions and table linking
- Next by Date: Re: how do i use passport to my benefit?
- Previous by thread: Re: Security restrictions and table linking
- Next by thread: Re: Security restrictions and table linking
- Index(es):
Relevant Pages
|