OpenRecordSet read permission

  • Thread starter Thread starter TC
  • Start date Start date
T

TC

Just a tip (not the cause of your problem): all methods of the dbengine
object (like opendatabase) should be explicitly qualified with the dbengine
keyword - eg. DBENGINE.opendatabase. Otherwise, unpredictable DAO licencing
errors can occur in certain cases.

HTH,
TC
 
This code used to work for me. I upgraded my database to Access 2002-2003
and moved it to a new shared folder on my NAS server. Everything is now
working, except this code. No matter what permissions the user has, it
stops at
"Set rstInventory = _
dbsInventory.OpenRecordset("Inventory Items", dbOpenDynaset)" and
gives an error that I don't have read permissions on "Inventory Items".

The folder that the database is in grants full control to everyone. Did
something change between Access 2000 and 2002-2003?

Thanks in advance for your assistance.

<code>
Private Sub Creat_Inventory_Click()

Dim dbsInventory As Database
Dim rstInventory As Recordset
Dim StrItem As String
Dim StrBin As String
Dim StrQty As String
Dim StrCode As String
Dim strLotID As String
Dim lbincount As Long
Dim lbincount2 As Long

Set dbsInventory = OpenDatabase("\\IH-NAS01\Access data\IHDATA.mdb")
Set rstInventory = _
dbsInventory.OpenRecordset("Inventory Items", dbOpenDynaset)
lbincount = Me![fromNum]
lbincount2 = Me![ToNum] + 1

Do
If Lot.Value <> "" And Bin.Value <> "" And Quantity.Value <> "" Then

StrItem = (Code) & "-" & (Lot) & "-" & (lbincount)
StrBin = ([Bin].Value)
StrQty = ([Quantity].Value)
strLotID = ([product].Value)
lbincount = lbincount + 1
End If
' Call the function that adds the record.
AddName rstInventory, StrItem, StrBin, StrQty, strLotID

Loop While lbincount < lbincount2
rstInventory.Close
dbsInventory.Close



Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Inventory Items"

stLinkCriteria = "[IHLots_ID]=" & Me![product]
DoCmd.OpenForm stDocName, , , stLinkCriteria


End Sub
</code>
 
Thank you, I will add this. I found that if I give the Backend database
Admin account rights to the tables, the code works. I had demoted admin to
a user account for security.


TC said:
Just a tip (not the cause of your problem): all methods of the dbengine
object (like opendatabase) should be explicitly qualified with the dbengine
keyword - eg. DBENGINE.opendatabase. Otherwise, unpredictable DAO licencing
errors can occur in certain cases.

HTH,
TC


Fredrick A. Zilz said:
This code used to work for me. I upgraded my database to Access 2002-2003
and moved it to a new shared folder on my NAS server. Everything is now
working, except this code. No matter what permissions the user has, it
stops at
"Set rstInventory = _
dbsInventory.OpenRecordset("Inventory Items", dbOpenDynaset)" and
gives an error that I don't have read permissions on "Inventory Items".

The folder that the database is in grants full control to everyone. Did
something change between Access 2000 and 2002-2003?

Thanks in advance for your assistance.

<code>
Private Sub Creat_Inventory_Click()

Dim dbsInventory As Database
Dim rstInventory As Recordset
Dim StrItem As String
Dim StrBin As String
Dim StrQty As String
Dim StrCode As String
Dim strLotID As String
Dim lbincount As Long
Dim lbincount2 As Long

Set dbsInventory = OpenDatabase("\\IH-NAS01\Access data\IHDATA.mdb")
Set rstInventory = _
dbsInventory.OpenRecordset("Inventory Items", dbOpenDynaset)
lbincount = Me![fromNum]
lbincount2 = Me![ToNum] + 1

Do
If Lot.Value <> "" And Bin.Value <> "" And Quantity.Value <> "" Then

StrItem = (Code) & "-" & (Lot) & "-" & (lbincount)
StrBin = ([Bin].Value)
StrQty = ([Quantity].Value)
strLotID = ([product].Value)
lbincount = lbincount + 1
End If
' Call the function that adds the record.
AddName rstInventory, StrItem, StrBin, StrQty, strLotID

Loop While lbincount < lbincount2
rstInventory.Close
dbsInventory.Close



Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Inventory Items"

stLinkCriteria = "[IHLots_ID]=" & Me![product]
DoCmd.OpenForm stDocName, , , stLinkCriteria


End Sub
</code>
 
Back
Top