Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3211

Status
Not open for further replies.

Rjc8513

Technical User
Feb 12, 2001
140
US
I'm attempting to delete a column from a table using "ALTER TABLE...DROP COLUMN..." but I'm getting the error message:

"Run-time error '3211': The database engine could not lock table "WKHR DATA" because it is already in use by another person or process."

Here is the offending code:

Set tdfPlan = Nothing

With rstPlan
If .RecordCount <> 0 Then
.MoveLast
NoRecords = .RecordCount
.MoveFirst
For I = 1 To NoRecords
WeekNo = .Fields("WEEK NO").Value
If Mid(WeekNo, 6, 2) <> "53" Then
dbs.Execute "UPDATE [WKHR DATA] " & _
"SET [WKHR DATA].[WEEK " & Mid(WeekNo, 6, 2) & "B]" & _
"=[" & WeekNo & "]+[WEEK " & Mid(WeekNo, 6, 2) & "B];"
dbs.Execute "ALTER TABLE [WKHR DATA] " & _
"DROP COLUMN [" & WeekNo & "];"
Else
...
End If
.MoveNext
Next I
End If
End With

Thanks.
 
well, it looks like something is holding the table locked, check if there are users or processes looking at that table...

--------------------
Procrastinate Now!
 
There are no other users, and I was stepping through the code so there were no forms or reports open.
 
and on which table(s) is based rstPlan ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Oops! I didn't make that clear.

Set rstPlan=dbs.OpenRecordset("tbl PLAN DATA FIELD NAMES")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top