You do not have exclusive access to the databse error

J

Jack Johnson

I have an access2000 database that I'm whipping up. So
far, all I have done is the database layout,
relationships, forms, and I started adding the VBA code
behind the forms.

When I run a form (to test my changes) that has a sub-form
and then exit by clicking the "X" (close window) in the
upper right corner, then try to open the form in design
view, I get the following error message.

"You do not have exclusive access to the database at this
time. If you proceed to make changes, you may not be able
to save them."

I get this error on every form I try to open. The only
way to get rid of it is to either repair the database or
exit access.

Through my testing I've discovered that the error only
starts happening when I run that specific form and click
on anything in the sub-form. It does not happen when I
run any other forms, or when I run the problem form and do
not click in the sub-form.

Thank you in advance for any help provided.
 
J

Jack Johnson

I have additional information. I am not using this in a
multi-user or multi-computer network. Nobody has access
to my machine.

I am beginning to turn my attention on the possibility
that when I close the main form, it is hanging the sub-
form or hanging the code running in the sub-form.

Here is the only code I have in the sub-form.

Private Sub Last_Name_Click()
Dim W As Workspace
Dim D As Database
Dim NR As DAO.Recordset
Dim ER As DAO.Recordset
Dim mainform As Form
Dim pilot As DAO.Recordset
Set W = CreateWorkspace("", "Admin", "", dbUseJet)
Set D = W.OpenDatabase("Air Races")
Set NR = D.OpenRecordset("Novice Temp Random Table",
dbOpenDynaset)
Set ER = D.OpenRecordset("Expert Temp Random Table",
dbOpenDynaset)
Set mainform = Forms("Pilots Check In")
Set pilot = mainform.RecordsetClone

pilot.FindFirst "Uniqueid = " & Me.Pilot_ID
mainform.Bookmark = mainform.RecordsetClone.Bookmark

mainform.SetFocus

If mainform.Racing_Class = "N" Then
NR.FindFirst "Pilotsid = " & Me.Pilot_ID
If NR.NoMatch Then
mainform.Check_In.Enabled = True
mainform.Check_In = False
Else
mainform.Check_In.Enabled = False
mainform.Check_In = True
End If
Else
ER.FindFirst "Pilotsid = " & Me.Pilot_ID
If ER.NoMatch Then
mainform.Check_In.Enabled = True
mainform.Check_In = False
Else
mainform.Check_In.Enabled = False
mainform.Check_In = True
End If
End If

End Sub
 
D

Dirk Goldgar

Jack Johnson said:
I have additional information. I am not using this in a
multi-user or multi-computer network. Nobody has access
to my machine.

I am beginning to turn my attention on the possibility
that when I close the main form, it is hanging the sub-
form or hanging the code running in the sub-form.

Here is the only code I have in the sub-form.

Private Sub Last_Name_Click()
Dim W As Workspace
Dim D As Database
Dim NR As DAO.Recordset
Dim ER As DAO.Recordset
Dim mainform As Form
Dim pilot As DAO.Recordset
Set W = CreateWorkspace("", "Admin", "", dbUseJet)
Set D = W.OpenDatabase("Air Races")
Set NR = D.OpenRecordset("Novice Temp Random Table",
dbOpenDynaset)
Set ER = D.OpenRecordset("Expert Temp Random Table",
dbOpenDynaset)
Set mainform = Forms("Pilots Check In")
Set pilot = mainform.RecordsetClone

pilot.FindFirst "Uniqueid = " & Me.Pilot_ID
mainform.Bookmark = mainform.RecordsetClone.Bookmark

mainform.SetFocus

If mainform.Racing_Class = "N" Then
NR.FindFirst "Pilotsid = " & Me.Pilot_ID
If NR.NoMatch Then
mainform.Check_In.Enabled = True
mainform.Check_In = False
Else
mainform.Check_In.Enabled = False
mainform.Check_In = True
End If
Else
ER.FindFirst "Pilotsid = " & Me.Pilot_ID
If ER.NoMatch Then
mainform.Check_In.Enabled = True
mainform.Check_In = False
Else
mainform.Check_In.Enabled = False
mainform.Check_In = True
End If
End If

End Sub

Is "Air Races" the current database, or a separate one? Why are you
creating a separate workspace, instead of the current one?
 

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

Top