Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access DB getting corrupted?

Status
Not open for further replies.

kovas

Technical User
Aug 6, 2002
88
US
Sometimes when ppl just power off their pc without shutting down properly my access db gets corrupted, I usually just repair it and its fine after that. But until i repair it the app gives an error saying DB not recognized. Is there someway I can automate it to repair it self without me doing it manually to avoid down time?
 
You can create a batch file (DOS anyone?) that you could run when the computer restarts.

For example, in notepad create a file called repair.bat.
Add a line with the location of the msacces.exe and the location of the database to repair and compact, then the /repair /compact parameters.

The line of text looks something like this:

c:\program files\ms office\office\msaccess.exe c:\My Program Directory\My.mdb /repair /compact

Go to the Windows Startup Folder and add a shortcut to the repair.bat file.

The next time Windows starts, the batch file will run and if you are lucky, repair and compact the database.

The second thing you will need to do is slap the ppl on the back of the hand/head about powering down the pc without shutting down Windows. [mad] Anthony J. DeSalvo
President - ScottTech Software
"Integrating Technology with Business"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top