I've been through a lot of "fixes" for this but nothing works. When I run this code and the user presses cancel, I get a dialog box that tells me cancel was pressed and it stops on the .showsave line. Clicking help shows the list of all error constants but no trapping seems to work.
The CopyFileEvenIfOpen subroutine uses an API call but the sub never gets that far if the commondialog is cancelled or closed so I won't put the code in here - besides it works perfectly if the user clicks save. I just get the dialog box telling me cancel was pressed and I can debug (.showsave highlighted) or end. I don't see the problem with this code ... what am I doing wrong?
TIA,
Ken
Code:
Dim SourceFile As String
On err GoTo CancelError
SourceFile = App.Path & "\Rentals.mdb"
With CommonDialog
.FileName = SourceFile
.Filter = "MDB Files(*.mdb)|*.mdb|All Files(*.*)|*.*"
.CancelError = True
.ShowSave
End With
CopyFileEvenIfOpen SourceFile, Me.CommonDialog.FileName
Exit Sub
CancelError:
stop
err.Clear
Exit Sub
TIA,
Ken