1

I need to convert about 50 .accdb files to .mdb. I know that there is a way to do it in Access itself, but I would rather not open up 50 Access databases to manually convert each.

Is it possible to do this in PowerShell? Would just renaming the extension be enough, or is it more complicated than that?

1
  • Just changing the file extension is definitely not enough. See if you can use the DBEngine.CompactDatabase Method from PowerShell. And beware if your ACCDB includes features which are not supported in the MDB format, the conversion attempt will likely fail. Commented Mar 22, 2016 at 16:06

1 Answer 1

1

Would just renaming the extension be enough, or is it more complicated than that?

There is definitely more to it than that.

The following code seems to have worked for me. It converted the tables at least. There was a form in the .accdb that didn't get copied over to the .mdb so perhaps it has properties that aren't supported in the older file format (ref: Hans' comment to the question).

$Access = New-Object -com Access.Application
$Access.ConvertAccessProject(
        "C:\Users\Public\test\test.accdb", 
        "C:\Users\Public\test\test2000.mdb", 
        "acFileFormatAccess2000")
$Access.Quit()
Sign up to request clarification or add additional context in comments.

2 Comments

I got this to work, but I had to take the '$' out from in front of acFileFormatAccess2000 and I put it in quotes instead.
@chrisdoubleu13 - Right, sorry about that. That line of code was left over from some earlier attempts. I have updated my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.