Database is read-only. dbOpenDynaset & dbSQLPassThrough

G

Grant

Hi.

I get an error of "the Database is read-only" when I run the following code:

'set current database connection
Set dbsCurrent = CurrentDb

' Create QueryDef
'Select all user names with there user group from tables sysSecUserName and
sysSecUserGroups
Set qdfUserAccess = dbsCurrent.CreateQueryDef("")

With qdfUserAccess
.Connect = "ODBC;DSN=Budget;DATABASE=Budget;Trusted_Connection=Yes"
.SQL = "SELECT UserName, SecGroups.UserGroup, " & _
"Enabled, LastAccessTime, LastMachineName " & _
"FROM sysSecUserNames SecNames " & _
"INNER JOIN sysSecUserGroups SecGroups " & _
"ON SecNames.UserGroup = SecGroups.UserGroupCode " & _
"WHERE UserName = '" & NetUserID() & "'"
Set rstUserNames = .OpenRecordset(dbOpenDynaset, dbSQLPassThrough)
End With

This is the bit that causes the error:

With rstUserNames
.Edit
!LastAccessTime = Now()
.Update
End With


Does anyone have any idea of what the problem may be? Is it something to do
with the created the Recordset by using a dbSQLPassThrough option?

Thanks for any replies.
Grant.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top