I am trying to connect to DB2 with a connection string but it is giving me an error, the connection cannot be used to perform this operation: please help because i have double checked and i cant find anything wrong with it: it gives me the error on the line in bold




Code:
Public Sub LoopQueries()
Dim i As Long
Dim MFcnn As New ADODB.Connection
Set MFcnn = New ADODB.Connection
With MFcnn
.Provider = "IBMDADB2.DB2COPY2"
.Mode = adReadWrite
.ConnectionString = "Password=" & password & ";Persist Security Info=True;User ID=" & username & ";Data Source=" & DatabaseEnv & ";Mode=ReadWrite;"
'.Open
Dim rsMFcnn As ADODB.Recordset
Set rsMFcnn = New ADODB.Recordset
Dim SQL As String
SQL = Sheet1.Range("AE2")
With rsMFcnn

.Open SQLSheet1.Range("AC2").CopyFromRecordset rsMFcnn
.Close
End With
cnMFcnn.Close
Set rsMFcnn = Nothing
Set cnMFcnn = Nothing

For j = 1 To 2
If (Sheet1.Cells(i, 1) = "") Then
j = 2
Else
j = 1
i = i + 1
End If
Next


End With

End Sub