Hi,
I have an application that copies specific files from the local drive to a server, then gives the user a message box that states how many files have been moved, then makes a backup copy to an archieve folder on the local drive and finally replaces the original files with blank ones.
I have created an error trap just in case if the user is not connected to the server. The problem is that in my code even after the "GoTo NoDriveMapped" is executed, the code returns back to the procedure and then executes the message box that states how many files have been copied, then backs up the files to a local folder and erases the original files.
What I need is that after the NoDriveMapped error trap, I want the whole thing to end.
Any pointers is appreciated,
Safa
****CODE******
Private Sub CmdStartTrnsfr_Click()
FileOperation fovCopy, "C:\CGRAS\SM_Geography\Graffiti.*", "\\Csmfs\\GRAFFITI_1", fofNoConfirmMakeDir
'CHANGE THE FOLDER LOCATIONS AND SERVER NAMES HERE
Dim sSource As String
Dim sFileType As String
Dim numFiles As Long
'initialize values
sSource = "\\Csmfs\GRAFFITI_1\"
'CHANGE THIS DIRECTORY NAME FOR EACH INDIVIDUAL MACHINE FOLDER
sFileType = "Graffiti.*"
'get the count
numFiles = FilesCountAll(sSource, sFileType)
If numFiles = 0 Then
GoTo NoDriveMapped
Else
MsgBox "Copying Completed Successfully!" & vbNewLine & vbNewLine & numFiles & " files copied to: " & sSource _
, vbOKOnly Or vbInformation _
, "CGRAS GRAFFITI SYSTEM"
Call BackupFilestoLocal
End
End If
Exit Sub
NoDriveMapped:
MsgBox "Copying Failed !!! - MAKE SURE YOU ARE CONNECTED TO THE WIRELESS ACCESS", vbCritical, "NO MAPPED DRIVE"
Exit Sub
I have an application that copies specific files from the local drive to a server, then gives the user a message box that states how many files have been moved, then makes a backup copy to an archieve folder on the local drive and finally replaces the original files with blank ones.
I have created an error trap just in case if the user is not connected to the server. The problem is that in my code even after the "GoTo NoDriveMapped" is executed, the code returns back to the procedure and then executes the message box that states how many files have been copied, then backs up the files to a local folder and erases the original files.
What I need is that after the NoDriveMapped error trap, I want the whole thing to end.
Any pointers is appreciated,
Safa
****CODE******
Private Sub CmdStartTrnsfr_Click()
FileOperation fovCopy, "C:\CGRAS\SM_Geography\Graffiti.*", "\\Csmfs\\GRAFFITI_1", fofNoConfirmMakeDir
'CHANGE THE FOLDER LOCATIONS AND SERVER NAMES HERE
Dim sSource As String
Dim sFileType As String
Dim numFiles As Long
'initialize values
sSource = "\\Csmfs\GRAFFITI_1\"
'CHANGE THIS DIRECTORY NAME FOR EACH INDIVIDUAL MACHINE FOLDER
sFileType = "Graffiti.*"
'get the count
numFiles = FilesCountAll(sSource, sFileType)
If numFiles = 0 Then
GoTo NoDriveMapped
Else
MsgBox "Copying Completed Successfully!" & vbNewLine & vbNewLine & numFiles & " files copied to: " & sSource _
, vbOKOnly Or vbInformation _
, "CGRAS GRAFFITI SYSTEM"
Call BackupFilestoLocal
End
End If
Exit Sub
NoDriveMapped:
MsgBox "Copying Failed !!! - MAKE SURE YOU ARE CONNECTED TO THE WIRELESS ACCESS", vbCritical, "NO MAPPED DRIVE"
Exit Sub