Sub CompactRepairDB() Dim strFilePath As String strFilePath = CurrentProject.Path Application.CompactRepair strFilePath & "\B.accdb", _ strFilePath & "\S.accdb", True End Sub