aziz rasul
Active member
- Local time
- Today, 17:03
- Joined
- Jun 26, 2000
- Messages
- 1,935
I have two dbs (which are scheduled overnight) that use multiple DoCmd.TransferSpreadsheets commands.
The scheduled tasks overlap, which is unavoidable.
When db1 is using it's DoCmd.TransferSpreadsheets commands, db2 issues an error when it tries to carry out it's DoCmd.TransferSpreadsheets commands. I want to error trap db2 such that when db1 finishes, the DoCmd.TransferSpreadsheets commands for db2 can carry on. Heres the snippet of code that I'm using.
When it errors the first time, it error traps OK. But in the second time it shows up the error dialog box and doesn't go to the error handling code??? Almost as if it doesn't recognise the error trapping piece of code.
The question is why is this happening?
The scheduled tasks overlap, which is unavoidable.
When db1 is using it's DoCmd.TransferSpreadsheets commands, db2 issues an error when it tries to carry out it's DoCmd.TransferSpreadsheets commands. I want to error trap db2 such that when db1 finishes, the DoCmd.TransferSpreadsheets commands for db2 can carry on. Heres the snippet of code that I'm using.
Code:
Goto1:
Debug.Print Now & " : " & "qryTotal_IPC"
strExcel = "qryTotal_IPC1"
DoCmd.TransferSpreadsheet acExport, 8, "qryTotal_IPC", strCurrentpath, False, "RollingNPS"
ErrorHandler:
If Err.Number = 0 Then
ElseIf Err.Number = 3051 Then
If Err.Description = "The Microsoft Jet database engine cannot open the file '\\w2k6001\data\CSDGAPP\BGB\BGB_MI_Reports\SME\ONE\OAMReport.xls'. It is already opened exclusively by another user, or you need permission to view its data." Then
For j = 1 To 6
For i = 1 To 2000000000#
Next i
Next j
If strExcel = "qryTotal_IPC1" Then
GoTo Goto1
End If
ElseIf Err.Description = "The Microsoft Jet database engine cannot open the file '\\w2k6001\data\CSDGAPP\BGB\BGB_MI_Reports\SME\ONE\MEOAMReport_.xls'. It is already opened exclusively by another user, or you need permission to view its data." Then
For j = 1 To 6
For i = 1 To 2000000000#
Next i
Next j
If strExcel = "qryTotal_IPC2" Then
GoTo Goto2
End If
End If
End If
When it errors the first time, it error traps OK. But in the second time it shows up the error dialog box and doesn't go to the error handling code??? Almost as if it doesn't recognise the error trapping piece of code.
The question is why is this happening?