P.Harrison
P.Harrison

Reputation: 189

Open MS Access database that is over 2GB

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.

Upvotes: 1

Views: 1301

Answers (1)

Erik A
Erik A

Reputation: 32672

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.

Upvotes: 1

Related Questions