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.
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.