help with adding a delay in processing

  • Thread starter Thread starter karen scheu via AccessMonster.com
  • Start date Start date
K

karen scheu via AccessMonster.com

I am trying to rename an mdb then compact the new name into the original name.
My problem is that I am getting error number 75 Path/file error because the
compact tries to start before the rename completes. I know I have to put in
some sort of delay, but is it DoEvents, or do I call a sleep procedure? Here
is my code:

NewName = Replace(SourceFile, "SOData.mdb", "SOData_hold.mdb")

If Dir(NewName) <> "" Then
Kill NewName
End If

Name SourceFile As NewName

DBEngine.CompactDatabase NewName, SourceFile

Thanks,
Karen
 
Back
Top