ACC: Second OpenRecordset Fails with Run-Time Error 3008 HELP!

G

Guest

I have received this error. On checking my form ..the Recordset Type is in
the Dynaset setting.

I have a table with multiple yes/no conditions. I wanted the Yes/no
conditions to be exclusive. The settings are controled by the form. On a
click of a the Yes/No on the form , I do a DOCmd.Close of the form and then
run a query to clear certain flags in the table. I then re open the form to
check the settings of the table.

No other processes have access to the table. As the form is closed that has
control to the table, why do I get the error that the table is locked?
===========================
Private Sub Command32USAOnly_Click()
On Error GoTo Err_Command32USAOnly_Click

DoCmd.Close
(CLOSES FORM)

Dim stDocName As String

stDocName = "Qry E-mail-USA Address"
DoCmd.OpenQuery stDocName, acNormal, acEdit
(RUNS QRY TO RESET OTHER FLAGS)

Dim stLinkCriteria As String

stDocName = "Form Label Filter"
DoCmd.OpenForm stDocName, , , stLinkCriteria
(RE OPENS FORM TO CHECK RESULTS)

Exit_Command32USAOnly_Click:
Exit Sub

Err_Command32USAOnly_Click:
MsgBox Err.Description
Resume Exit_Command32USAOnly_Click

End Sub
====================================
Help is needed!
 
G

Guest

It would appear that the recordset object is being created in the form
module. When you close the form, the object is destroyed, but you have not
closed the recordset. It may be that Jet has not had time to release the
reference to it before you query runs.

What is the purpose of closing then reopening the form? That seems to be a
lot of extra overhead for no apparent benefit. If it is a matter of not
wanting the user to be able to do anything while the query is running, there
are other ways to do that.
 
G

Guest

The purpose is to be able to set a flag in a table by the form and selectivly
clear other flags in the table by a query after a given flag is set. On
viewing the status of the form, the user can see what flags are set and
clear. The flags identify certain product deliveries in certain combinations
and provide filters of the data.

Other processes will use the flags to deliver certain products based on the
flag settings.

Reopening the form after the query is run shows the results of all the flag
settings in the table.

If, as you suggest, that Jet has "not released" the Reference Set when the
query is to be run, is there away in code to delay the activation of the
query so that the table is not locked.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top