L
LMC
I am using MS-Access 2003 SP3. The code below compiles but errors on the
db.Execute line when the code is run.
Dim strUser as String, strSQL as String, strTbl as String
Dim db as DAO.Database
Set db = CurrentDB()
strUser = NetworkUserName
strSQL = "GRANT UPDATEIDENTITY ON " & strTbl & " TO " & strUser
db.Execute strSQL, dbFailOnError
...............additional code...............
db.Close
Set db = Nothing
strUser is the result of a function that correctly returns the network user
id of the person currently logged in. There is no further security set on the
database other than Active Directory permissions applied to the server where
the database resides.
strTbl is a variable string that accurately holds the table name of the
AutoNum field that I want to be updatable via code.
When I enter the SQL below, without the variable strings, into the standard
Query window to test it, it produces the following error upon saving the data
definition query. SQL statement; expected 'DELETE', 'INSERT', "PROCEDURE',
'SELECT", or 'UPDATE'.
GRANT UPDATEIDENTITY ON TableName TO CurrentUser
I've looked on the web and in MS-Access Help for examples of code using this
option; but have found only definitions that give the general syntax and say
that it will allow updating of numbers in AutoNum fields.
Any Help is appreciated.
LMC
db.Execute line when the code is run.
Dim strUser as String, strSQL as String, strTbl as String
Dim db as DAO.Database
Set db = CurrentDB()
strUser = NetworkUserName
strSQL = "GRANT UPDATEIDENTITY ON " & strTbl & " TO " & strUser
db.Execute strSQL, dbFailOnError
...............additional code...............
db.Close
Set db = Nothing
strUser is the result of a function that correctly returns the network user
id of the person currently logged in. There is no further security set on the
database other than Active Directory permissions applied to the server where
the database resides.
strTbl is a variable string that accurately holds the table name of the
AutoNum field that I want to be updatable via code.
When I enter the SQL below, without the variable strings, into the standard
Query window to test it, it produces the following error upon saving the data
definition query. SQL statement; expected 'DELETE', 'INSERT', "PROCEDURE',
'SELECT", or 'UPDATE'.
GRANT UPDATEIDENTITY ON TableName TO CurrentUser
I've looked on the web and in MS-Access Help for examples of code using this
option; but have found only definitions that give the general syntax and say
that it will allow updating of numbers in AutoNum fields.
Any Help is appreciated.
LMC