Private Sub Cmd查询_Click()
Dim Lpx1 As Command
Dim rs1 As Recordset, str1 As String
Dim fldloop As ADODB.Field
'defind and execute command
Set Lpx1 = New ADODB.Command
With Lpx1
.ActiveConnection = CurrentProject.Connection
.CommandText = "SELECT tbl住户.* FROM tbl住户"
.CommandType = adCmdText
.Execute
End With
'open and print recordset
Set rs1 = New ADODB.Recordset
rs1.Open Lpx1
Do Until rs1.EOF
str1 = ""
For Each fldloop In rs1.Fields
str1 = str1 & fldloop.Value & Chr(9)
Next fldloop
'DoCmd.OpenForm "frm查询1"
Debug.Print str1
rs1.MoveNext
Loop
End Sub