Error 3211

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I am working in an Access 97 database.
I am trying to delete a temporary table (used for
importing data)that I have just worked with in the
previous code.

I am getting an Error 3211:

"The database engine couldn't lock the
table "tblABAgClaims" because it's already in use by
another person or process.

How do I release the table in the code so that I can
delete it?

See the code below

Thanks if you have an answer!

Mark Weiler
Ontario Canada

Set wsCurrent = DBEngine.Workspaces(0)
Set dbCurrent = wsCurrent.Databases(0)

wsCurrent.BeginTrans
strSQL = "UPDATE tblMeterLocation INNER JOIN
tblABAgClaims ON (tblMeterLocation.MeterLocationID =
tblABAgClaims.MeterLocationID) AND
(tblMeterLocation.ApplicantID = tblABAgClaims.ApplicantID)
SET tblMeterLocation.ABAgComments = [tblABAgClaims]![AB
Agriculture Comments], tblMeterLocation.ABAgDateReceived =
Date() " & _
"WITH OWNERACCESS OPTION;"
Set qdfUpdateClaims = dbCurrent.CreateQueryDef("",
strSQL)
'qdfUpdateClaims.Parameters(0) = Z
qdfUpdateClaims.Execute dbFailOnError
wsCurrent.CommitTrans 'applies all of the
transactions to all of the tables

DoCmd.DeleteObject acTable, "tblABAgClaims"
Exit Sub
 
It looks like if you close your Query Def
object,"qdfUpdateClaims", before you delete the table it
should work.

i.e.
....
qdfUpdateClaims.Close
Set qdfUpdateClaims=nothing

DoCmd.DeleteObject acTable, "tblABAgClaims"
Exit Sub
 
Back
Top