I'm trying to backup a database but I want the process to be run in
the background so it doesn't lock up my program. I am doing the
following inside a class, it backs up the database in the background
just fine but it never fires ExecuteComplete. Any idea why??
Option Explicit
Private WithEvents myConn As ADODB.Connection
Public Function backup() As Boolean
Set myConn = New ADODB.Connection
If myConn.State = 0 Then
myConn.Open strConnect
myConn.CommandTimeout = 1000
End If
myConn.execute "BACKUP DATABASE MyDB TO DISK = 'C:\Temp\Backup'
WITH INIT", , adAsyncExecute
End Function
Private Sub myConn_ExecuteComplete(ByVal RecordsAffected As Long,
ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal
pCommand As ADODB.Command, ByVal pRecordset As ADODB.Recordset, ByVal
pConnection As ADODB.Connection)
MsgBox "BACKUP COMPLETE"
End Sub
Ralph - 20 Feb 2008 23:16 GMT
> I'm trying to backup a database but I want the process to be run in
> the background so it doesn't lock up my program. I am doing the
[quoted text clipped - 27 lines]
>
> End Sub
Are you opening the connection asynchronously (adConnectAsync)?
-ralph
hurricane_number_one@yahoo.com - 21 Feb 2008 05:23 GMT
I tried to open the connection asynchronously, but it never kicks off
the ConnectComplete event.
> <hurricane_number_...@yahoo.com> wrote in message
>
[quoted text clipped - 35 lines]
>
> -ralph
hurricane_number_one@yahoo.com - 21 Feb 2008 05:32 GMT
Yes, I tried that and it didn't make a difference:
> <hurricane_number_...@yahoo.com> wrote in message
>
[quoted text clipped - 35 lines]
>
> -ralph