KadeFoster
Registered User.
- Local time
- Today, 16:47
- Joined
- Apr 7, 2012
- Messages
- 67
Hey all,
OK so in my project I have automated the copying of files from the BE location to the FE location. This process takes about 1 minute as there are a few gig of maps to copy across to the end users FE location. While the code is executing the Access bar goes white and says No Responding. The code runs no issues but it displays this. To the end user this looks like a problem, but I know the code is fine.
I have looked around a lot and found that i should throw in DoEvents into the code, but its really one like of code that is taking the most time. Below is what I have, all suggestions are welcome.
OK so in my project I have automated the copying of files from the BE location to the FE location. This process takes about 1 minute as there are a few gig of maps to copy across to the end users FE location. While the code is executing the Access bar goes white and says No Responding. The code runs no issues but it displays this. To the end user this looks like a problem, but I know the code is fine.
I have looked around a lot and found that i should throw in DoEvents into the code, but its really one like of code that is taking the most time. Below is what I have, all suggestions are welcome.
Code:
'Checking If File Is Located in the Source Folder
If fso.FolderExists(strFELocation & "MAPS-OUTSTANDING") Then
MsgBox "Outstanding directrory exists. The folder will now be deleted and the latest maps will be copied to your device.", vbInformation, "Folder Exists"
' Debug.Print "OutstandingFolder: "; strFELocation & "MAPS-OUTSTANDING"
fso.DeleteFolder strFELocation & "\" & "MAPS-OUTSTANDING", True
fso.DeleteFolder strFELocation & "\" & "FIREPLANS", True
DoCmd.Hourglass True ' turn on Hourglass
fso.CopyFolder strOutstandingFolderPath, strFELocation '<<<<<<<<<<<<<<<<<<< Longest Copying
fso.CopyFolder strFirePlanPath, strFELocation
fso.CopyFile strFirePlanShort, strFELocation, True
MsgBox "Outstanding directory Copied Successfully", vbInformation, "Done!"
DoCmd.Hourglass False ' turn off hourglass
Exit Sub
ElseIf MsgBox("You are about to copy all the current outstanding maps to your Database location:" & vbCrLf & vbCrLf & _
"Are you sure?", vbYesNo, "Warning!") = vbYes Then
DoCmd.Hourglass True ' turn on Hourglass
DoEvents
fso.CopyFolder strOutstandingFolderPath, strFELocation '<<<<<<<<<<<<<<<<<<< Longest Copying
DoEvents
fso.CopyFolder strFirePlanPath, strFELocation
fso.CopyFile strFirePlanShort, strFELocation, True
MsgBox "Outstanding directory Copied Successfully", vbInformation, "Done!"
DoCmd.Hourglass False ' turn off hourglass
Exit Sub
Else
Exit Sub
End If