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>