By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,100 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

problem with locked records

P: n/a
Hey guys,
i'm kinda new with access, despite having worked with it all
summer. I'm getting an error with a vba function i wrote to take some
information from an access form and put it into a bunch of tables in
an access database. if i insert a bunch of break points and slowly
walk through everything there is no problem. But if i just run it i
get an error about trying to access a record that is locked by another
user i believe. It seems to mostly occur in a part of the function
that is a while loop that looks something like this
While Not IsNull(assetArr(currindex, CurrAccIndex))
Me.lstPOacc.BoundColumn = 1
CurrAccCLIN = Me.lstPOacc.ItemData(CurrAccIndex)
Me.lstPOacc.BoundColumn = 2
currAccPrice = Me.lstPOacc.ItemData(CurrAccIndex)

'Open recordset
With rs1
Set .ActiveConnection = conn
.Source = "accessory"
.LockType = adLockOptimistic
.Open
End With

rs1.AddNew
rs1("accCLIN") = CurrAccCLIN
rs1("dateAdded") = Me.txtPoPstart
rs1("assetKey") = currAssetKey
rs1.Update
currAccKey = rs1.Fields("AccID")
rs1.Close

'add info to rel acc form
strSQL = "INSERT INTO rel_acc_form (AccID,FormID,cost)
VALUES (" & _
"currAccKey & "," & currformid & "," &
currAccPrice & ");"
DoCmd.RunSQL (strSQL)

CurrAccIndex = CurrAccIndex + 1
Wend

but i think it may be happening in other places in the function as
well. Is access not finishing releasing a record before it tries to
use it again? is there something obvious i'm missing...sorry about
the weak code, i've been in kinda a rush.
thanks for any help you can give me,
Keith
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.