Hello,
I have these two pieces of code in a book :-
1)
Dim cmd1 As ADODB.Command
Dim rst1 As ADODB.Recordset
Set cmd1 = New ADODB.Command
With cmd1
.ActiveConnection = CurrentProject.Connection
.CommandText = "SELECT * FROM mytbl;"
.CommandType = adCmdText
End With
Set rst1 = cmd1.Execute
Do Until rst.EOF
Debug.Print ......
Loop
2)
Dim rst1 As ADODB.Recordset
Set rst1 = New ADODB.Recordset
rst1.Open "SELECT * FROM mytbl;"
Do Until rst.EOF
Debug.Print ...
Loop
My question is what is the point of using Command in the first piece of code when it seems to function in exactly the same way without it in the second piece of code
Thanks
Phil
I have these two pieces of code in a book :-
1)
Dim cmd1 As ADODB.Command
Dim rst1 As ADODB.Recordset
Set cmd1 = New ADODB.Command
With cmd1
.ActiveConnection = CurrentProject.Connection
.CommandText = "SELECT * FROM mytbl;"
.CommandType = adCmdText
End With
Set rst1 = cmd1.Execute
Do Until rst.EOF
Debug.Print ......
Loop
2)
Dim rst1 As ADODB.Recordset
Set rst1 = New ADODB.Recordset
rst1.Open "SELECT * FROM mytbl;"
Do Until rst.EOF
Debug.Print ...
Loop
My question is what is the point of using Command in the first piece of code when it seems to function in exactly the same way without it in the second piece of code
Thanks
Phil