1

Hi there hopefully there is a fix for this but I my ms access program crashed before it could finish a clean up of the data. Its now hit its 2GB maximum and wont open anyone know what do here? I just need it to drop all the data in the columns the thing of value are the queries and what order they are in.

Just get the error Cannot Open database''. It may not be a database that your application recognises, or the file may be corrupt. It gives me that twice.

its in an .accdb format so that shouldnt be a reading issue

Cheers.

Besarion
  • 139
  • 11
  • Have you tried decompiling the database. Open Access using `C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE /decompile` and then your database. _It might work_. You may have to update the path to `Access.Exe`. – Darren Bartrup-Cook Sep 04 '18 at 16:14
  • I just have STSLIST.DLL in that folder. Sadly and 1033 which has STSLIST.CHM and STSLISTI.DLL – Besarion Sep 04 '18 at 16:19
  • did you mean in the Registry Editor? – Besarion Sep 04 '18 at 16:21
  • No, find the location that Access is installed in on your (I presume) `C` drive. Have a look at the answer given by Erik von Asmuth here: [How does one decompile and recompile a database application?](https://stackoverflow.com/questions/3266542/how-does-one-decompile-and-recompile-a-database-application) – Darren Bartrup-Cook Sep 04 '18 at 16:28
  • Sadly that hasn't worked it wont let me open it still same error message – Besarion Sep 04 '18 at 16:46
  • "C:\Program Files (x86)\Microsoft Office\root\Office15\MSACCESS.EXE" "C:\Users\User1\Desktop\AutomaticImport.accdb" /decomplie Thats the shortcut – Besarion Sep 04 '18 at 16:47

1 Answers1

1

Try running a compact and repair directly from the DAO database engine without opening the file in Access

You can use the following code from any VBA-enabled application or a VBScript file (it's designed for VBScript files, but you have to match bitness with your Access application, see this post, but should run fine from Excel as well)

Dim wShell, oExec, sFileSelected
Set wShell=CreateObject("WScript.Shell")
Set oExec=wShell.Exec("mshta.exe ""about:<input type=file id=FILE><script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""")
sFileSelected = oExec.StdOut.ReadLine
CreateObject("DAO.DBEngine.120").CompactDatabase sFileSelected, Left(sFileSelected, Len(sFileSelected) - 6) & "Compacted.accdb"

That should copy over everything from your corrupt database while compacting it. It creates a new file, with your current filename and Compacted appended to it.

Erik A
  • 31,639
  • 12
  • 42
  • 67
  • Do you mean just in excel make a button put that code between it and replace FILE with the location of the database: C:\Users\User1\Desktop\AutomaticImport.accdb. And then the all small case file = accdb – Besarion Sep 05 '18 at 07:15
  • I ask because i cant see how the program would know what its looking for – Besarion Sep 05 '18 at 07:40
  • It prompts for a file location. Either put it behind an Excel button, a different Access database, or a VBScript file. – Erik A Sep 05 '18 at 07:42
  • Thank you that worked a charm. Twice you've helped this week Erik take care – Besarion Sep 05 '18 at 07:52