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:
Expand|Select|Wrap|Line Numbers
- 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.CurrentDb, 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
Expand|Select|Wrap|Line Numbers
- Set objThisDb = CurrentDb()
- strThisDb = objThisDb.Name
- objThisDb.Close
- set objThisDb = Nothing
Can anyone help please? It's killing me!