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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compact Database Automation not working

Status
Not open for further replies.

AlexMidd

Programmer
May 14, 2001
655
NL
I don't know if anyone has come across this. I am using Access 97. I have a menu option for users to compact databses, as they get very large during use. It has always worked flawlessly in the past, i.e. on clicking the menu item the database compacts and reopens.

Now, when they click the menu item, Access asks for the file to compact (with Open Dialog) and the file to compact to (with Save As Dialog). It will not allow the current database to be compacted as it is open.

As the databases are secured, the Tools -> Database Utilities -> Compact Database option is not viable, and I do not want the users to have to do this anyway. Does anyone have any ideas as to why this worked before but no longer does. I have not changed any code so it is a bit of a mystery.
Have fun! :eek:)

Alex Middleton
 
How are you invoking the command in your code? Are you using the Sendkeys command? If so, the command will only work if the menu item is available.

HTH
Lightning
 
It is in a Macro which calls "RunCommand" - "CompactDatabase". As I say it has always worked before. Then it started doing this on one database but not the others. Now a second database is doing it. There is no difference between the macros in each database. Have fun! :eek:)

Alex Middleton
 
I have found only one workaround to compacting a database using Macros and/or VBA.


I send a bogus new name in my code, then delete the orgial file using the "Kill" statement. Lastly, I rename the new file to the old file name.

You state that it used to work. But, I would have to argue that you must have made some change somewhere...

Tyrone Lumley
augerinn@gte.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top