下面的程序只是演示,在实际程序中就用表格控件
Private Sub Form_Activate()
Adodc1.ConnectionString = cnstr
Adodc1.RecordSource = "SELECT b.人员,a.销售金额 FROM a,b WHERE a.ID=b.ID ORDER BY a.销售金额 DESC"
Adodc1.Refresh
End Sub
Public Function cnstr() As String
cnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\排名.mdb;Persist Security Info=True"
End Function
Private Sub Command1_Click()
Print "人员
销售金额
名次
"
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False And Adodc1.Recordset.BOF = False
Print Adodc1.Recordset(0); "
"; Adodc1.Recordset(1); "
"; Adodc1.Recordset.AbsolutePosition
Adodc1.Recordset.MoveNext
Loop
End Sub