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

Exit Access after Compacting (at night by macro)

Status
Not open for further replies.

BLPandAJF

Technical User
May 6, 2000
6
0
0
US
Hi-

I have a macro launched at night which deletes/appends lots of different tables and then the database is compacted. After the database is compacted, the switchboard is displayed (per the Startup options).

I need to quit Access as the last step in the process but if I add this command to the macro, it Quits before performing the compact. Without the Quit command, it works beautifully.

Any idea how I can accomplish this?

(I'm not sure if this will make a difference but as a crude security measure I have it set up so that if you load the database without depressing the shift key, all that you can access is the switchboard. This is how the database is opened "post" compact.)

Thanks for any help you can give.

 
I'm not sure your description is fully understable.

What do you launch at night? An Access .mdb with the tables attached with this macro as Autoexec?

What do you mean by switchboard?

Could you describe further your application?

Anyway when you encounter problems with a macro, whydon't you try to convert it to VB code on which you have deeper control? I think there is an utility to perform this task within Access 2000.


 
Create a Public variable in a standard module, call it varCompacted As Boolean. In the same module create a Public Function called Set_Compacted_True and inside the function write varCompacted = True. Now create another Public Function called Set_Compacted_False and insert varCompacted = False.

Create an AutoExec macro and make sure it contains a RunCode instruction which refers to the Set_Compacted_False function.

In the Switchboard Form's Open Event place code to enquire what condition varCompacted is in and close the Application if it's set to True, e.g. :

If varCompact Then
Quit
End If

Finally you need to add an instruction to your existing Macro to set the varCompacted variable to True, so when the Switchboard next opens the Application is closed. Do this by using the RunCode command to run the Set_Compacted_True public function.

I expect there's a neater way but I can't think of one right now.

Rod
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top