If you're asking how you can compact the currently open database in Access
97, you can't using either a macro or VBA code.
If you're asking how you can compact another database (such as compacting
the back-end database from the front-end database), you can use the
CompactDatabase method of the DBEngine object (look up "CompactDatabase
Method" in the Help file)