Hi all,
I have a problem which I can't figure out what is it caused by and how to solve it as I never expericed it before even though I've been using same approach many times before.
I have front end database with form that creates back end db, inserts new tables in BE and then creates linked tables in FE linked to BE. It used to work but stopped couple of days ago.
Ok, so I have that form with button calling the code - code is located in class objects rather than modules.
Everything goes just fine until I call a public function located in a module:
When it executes 'CurrentDb.Quer yDefs.Delete (strQueryName)' the database locks itself and when I try to save changes made during debugging of my code, it says: "Microsoft Office Access can't save design changes or save to a new database object because another user had the file open. To save changes or to save to a new object, you must have exclusive access to the file."
It must be associated with command Application.Cur rentDb, because when I earlier tried to exectue:
strThisDb = CurrentDb.Name , I was getting same error message when tried to save changes afterwards.
Even if I do it through
it doesn't change anything and I'm still unable to retrieve an exclusive access after code is executed.
Can anyone help please? It's killing me!
I have a problem which I can't figure out what is it caused by and how to solve it as I never expericed it before even though I've been using same approach many times before.
I have front end database with form that creates back end db, inserts new tables in BE and then creates linked tables in FE linked to BE. It used to work but stopped couple of days ago.
Ok, so I have that form with button calling the code - code is located in class objects rather than modules.
Everything goes just fine until I call a public function located in a module:
Code:
Public Function FindDelQryDef(strQueryName As String, blnDelete As Boolean) As Boolean
'Returns True if table or query exist in currentDb
Dim qryd As DAO.QueryDef
Dim blnResult As Boolean
blnResult = False
For Each qryd In CurrentDb.QueryDefs
If qryd.Name = strQueryName Then
blnResult = True
If blnDelete = True Then CurrentDb.QueryDefs.Delete (strQueryName)
Exit For
End If
Next qryd
Set qryd = Nothing
FindDelQryDef = blnResult
End Function
It must be associated with command Application.Cur rentDb, because when I earlier tried to exectue:
strThisDb = CurrentDb.Name , I was getting same error message when tried to save changes afterwards.
Even if I do it through
Code:
Set objThisDb = CurrentDb() strThisDb = objThisDb.Name objThisDb.Close set objThisDb = Nothing
Can anyone help please? It's killing me!
Comment