|
切换带VBE界面打开立即窗口查看执行情况(Ctrl+G)。
Private Sub Command0_Click()
Dim Rs As New ADODB.Recordset
Dim Conn As New ADODB.Connection
Set Conn = CurrentProject.Connection
Rs.Open "select name from Comp_temp1", Conn, adOpenKeyset, adLockOptimistic
Do While Not Rs.EOF
Debug.Print Rs.Fields(0)
Rs.MoveNext
Loop
Rs.Close
Rs.Open "select name from Comp_temp2", Conn, adOpenKeyset, adLockOptimistic
Do While Not Rs.EOF
Debug.Print Rs.Fields(0)
Rs.MoveNext
Loop
Set Rs = Nothing
Set Conn = Nothing
End Sub |
|