Err 3045 unable to use nameDB. File is in use.

mihego32 Posted messages 40 Status Membre -  
ron003 Posted messages 4 Registration date   Status Membre Last intervention   -
Good evening, Hello,

I feel completely at a loss in front of this message:
Cannot use "my-DB". File in use. (3045)
which occurs when the code associated with a button on a very simple form reaches the instruction "Set MyDB = CurrentDb" in this Sub (the appropriate declarations are OK):
Private Sub cmdImporterFiches_Click() ' Identifies the files present in the email extraction folder, ' processes the content and moves it to the Treated folder On Error GoTo HandleErrors Stop Set MyDB = CurrentDb ' <=== <=== <=== <=== <=== HERE IS THE FATAL ERROR Set wDossier = wFSO.GetFolder(Me.ctlChemin) For Each wFil In wDossier.Files If Left(wFil.Name, 9) = Me.ctlPréfixe Then Extract (wFil.Name) ' validation, reading and processing of each form If SwOK = True Then ' stop at the first unprocessable file wFil.Move Me.ctlChemin & Me.ctlFichesTraitées Else Exit For End If End If Next wFil Set MyDB = Nothing: Set wDoc = Nothing : Set wDossier = Nothing Set wFSO = Nothing: Set wApp = Nothing ExitHere: Exit Sub HandleErrors: HandleErrors Err.Number, "cmdImporterFiches_Click" Resume ExitHere End Sub '=======================================================

The only user of my PC running Win 8 Pro and msAccess 2010, I have tried with both .accdb and .mdb versions. I have tried compacting and repairing, with decompiling. I checked the permissions of the DB. I recreated a new DB, imported the objects: same error.
In VBA, I have in this order (and I have tried modifying the sequence) the following references:
- Visual Basic for Applications
- Microsoft Access 14.0 Object Library
- Ole Automation
- Microsoft Office 14.0 Access database engine Object Library
- Microsoft Scripting Runtime
- Microsoft Word 14.0 Object Library
The last two libraries being necessary to process Word forms. I specify that I had no problem opening these forms, analyzing them, and extracting the data, as long as I had not reached the opening of the DB and the tables.
I have tried alternative formulas to open the DB to access one of its tables:
Set MyDB = OpenDatabase(CheminNomDB, False) Set MyDB = DBEngine(0)(0)

I read on a site that the following instructions could solve the problem:
RefreshDatabaseWindow DBEngine.Idle dbRefreshCache

The first one runs but does not avoid the error on the Set MyDB, the second is enough to trigger error 3045.
I no longer had the error after transferring my databases from a folder "D:\Proj2013PO\DB" to a folder "D:\Proj2013PO\ProjetMSA", the name change was fruitful for 1 hour or 2, then it suddenly returned after I coded a few processing steps. This is not my first project with which I have this intermittent, unpredictable, and m... error. I have been developing MSA projects since Access 2 and I have been an analyst-programmer for 40 years. I must have about a dozen personal MSA applications, with multiple data DBs, etc. I have searched many sites but to no avail...
It's very simple: if this error continues to block me, I will have to abandon this project as a volunteer for an NGO of which I am a member. See if I need to ditch Microsoft Access in the future.
So any advice or opinion is welcome, and I thank you for your attention.
Michel

Configuration: Windows 8 PRO/ Firefox 18.0/Office 2010

2 réponses

mihego32 Posted messages 40 Status Membre 3
 
Hello,

I am still stuck at 100% despite my attempts yesterday and this morning.

I have therefore created a new DB "mini.mdb" in the root D:, with 1 table containing only a key field, 1 form without a source with 1 button that executes this code:
Dim MyDB As Database Private Sub cmdMini_Click() '============================== On Error GoTo GestionErreurs Stop Set MyDB = CurrentDb Set MyDB = Nothing ExitHere: Exit Sub GestionErreurs: GestionErreur Err.Number, "cmdMini_Click" Resume ExitHere End Sub '==========================================

Execution OK.
I then moved the database to the directory where I work "D:\po2013\ProjetMSA". I opened the database, activated it to eliminate the Windows 8 protection after moving the file, opened the form, clicked on the button and Arghh, ERR 3045 struck my astonished eyes again.
It is therefore possible (who knows?) that the problem is related to file and/or folder access:
- "mini.mdb": free access, the "Read-only" box is not checked. Advanced attributes section, 2 boxes are checked: "The file is ready to be archived" and "Allow indexing of the contents of this file in addition to the file properties"
- folder "ProjetMSA": the "Read-only (applies only to files in this folder)" box is in an intermediate state (small black square inside the box) between unchecked (white box) and checked (white box with the classic checkmark). I unchecked the box as well as the one for the parent folder "po2013", which resulted in a message with, among other things, a single checked box "Apply changes to this folder, subfolders, and files" with no possibility to uncheck it (and the other box is inaccessible); the only option: [OK].
- root D: 97.6 Go of which 14.6 used; I had set it to "Shared" when it shouldn't be, but who knows? "Authenticated Users," "Users," "Administrators," and "System" have full control. Hard to be more open. Quota management is not enabled.
New execution: same error and the "Read-only" box for the "ProjetMSA" folder is returned to an intermediate stage against my will; I read on a Microsoft site that it has no impact on file-level permissions.
I removed the indexing at the mini.mdb level. New attempt and still the error.
Where is this rope to hang myself? No, I will rather investigate the side of LibreOffice and besides it’s free and not like Office: hundreds of euros and years of practice and experience down the drain.
Michel
0