I want to do this as recommended in the Security FAQ, but I have so many
queries I don't want to edit each one manually.
I tried the following code to enumerate the properties in a query, but
RunPermissions doesn't appear to be one. So how can I set it?
Dim db As Database
Dim qdef As QueryDef
Dim prp As Property
Set db = CurrentDb
For Each qdef In db.QueryDefs
For Each prp In qdef.Properties
MsgBox prp.Name
Next prp
Next qdef
Any help gratefully received.
Thanks
Dave
Public Sub RWOP()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim strSQL As String
Set db = CurrentDb
For Each qdf In db.QueryDefs
strSQL = qdf.SQL
'At first I thought Left$(strSQL, Len(strSQL) - 1)
'would do it, but it doesn't work - there must be
'a carriage return or something after the semi-colon.
strSQL = Left$(strSQL, InStr(1, strSQL, ";") - 1)
strSQL = strSQL & " WITH OWNERACCESS OPTION;"
qdf.SQL = strSQL
Next qdf
Set qdf = Nothing
Set db = Nothing
End Sub
--
Brendan Reynolds
bren...@indigo.ie
http://www11.ewebcity.com/brenreyn
Dave Griffiths <da...@k2computers.co.uk> wrote in message
news:978734051.5689.0...@news.demon.co.uk...
--
Pete B
Brendan Reynolds <bren...@indigo.ie> wrote in message
news:b0t56.4474$s4....@news.indigo.ie...
Public Sub RWOP()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim strSQL As String
Set db = CurrentDb
For Each qdf In db.QueryDefs
strSQL = qdf.SQL
'At first I thought Left$(strSQL, Len(strSQL) - 1)
'would do it, but it doesn't work - there must be
'a carriage return or something after the semi-colon.
strSQL = Left$(strSQL, InStr(1, strSQL, ";") - 1)
strSQL = strSQL & " WITH OWNERACCESS OPTION;"
qdf.SQL = strSQL
'new code.
DoCmd.OpenQuery qdf.Name, acViewDesign
DoCmd.Close acQuery, qdf.Name, acSaveYes
Next qdf
Set qdf = Nothing
Set db = Nothing
End Sub
--
Brendan Reynolds
bren...@indigo.ie
http://www11.ewebcity.com/brenreyn
Pete B <bar...@datatek.com> wrote in message
news:t5ee9vn...@news.supernews.com...
And of course, doing so in an otherwise unsecured database, as you mentioned
you are doing, would accomplish nothing, because the owner of the qdef
object would be the Admin user; since OP queries cannot be modified by
anyone other than the owner, you have only restricted the modification
ability to the known universe (to wit, the Admin users), rather than to a
particular secured individual administrator :=). Making an OP query in an
unsecured database is a pointless exercise, except to test your code
perhaps. But I am sure you are aware of that.
The time to make a query into an OP query is after you have otherwise
secured the database completely. Also, of course, after you modify and save
the qdef object to make it an OP query owned by a secure administrator, you
would then have to follow up and set permits on the object for the other
users.
--
Pete B
Brendan Reynolds <bren...@indigo.ie> wrote in message
news:99K56.4683$s4....@news.indigo.ie...
--
Brendan Reynolds
bren...@indigo.ie
http://www11.ewebcity.com/brenreyn
Pete B <bar...@datatek.com> wrote in message
news:t5jlchi...@news.supernews.com...