用表格控件显示数据 Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Private Sub Form_Load() cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\数据库名.mdb;Persist Security Info=False" rs.Open "select * from 表名", cn, adOpenKeyset, adLockOptimistic Set MSHFlexGrid1.DataSource = rs rs.Close cn.Close End Sub
'窗体上放一个 Visible 属性 = False 的 ListBox, 两个 Lable 和 一个 Timer:Private Sub Form_Load() Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\数据库名.mdb;Persist Security Info=False" Set rs = cn.Execute("Select 姓名, 成绩 From 表") Do Until rs.EOF List1.AddItem rs!姓名 List1.ItemData(List1.NewIndex) = rs!成绩 Loop Set rs = Nothing cn.Close Set cn = Nothing
If List1.ListCount Then List1.ListIndex = 0 Label1 = List1.List(List1.ListIndex) End If
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\数据库名.mdb;Persist Security Info=False"
rs.Open "select * from 表名", cn, adOpenKeyset, adLockOptimistic
Set MSHFlexGrid1.DataSource = rs
rs.Close
cn.Close
End Sub
'窗体上放一个 Visible 属性 = False 的 ListBox, 两个 Lable 和 一个 Timer:Private Sub Form_Load()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\数据库名.mdb;Persist Security Info=False"
Set rs = cn.Execute("Select 姓名, 成绩 From 表") Do Until rs.EOF
List1.AddItem rs!姓名
List1.ItemData(List1.NewIndex) = rs!成绩
Loop Set rs = Nothing
cn.Close
Set cn = Nothing
If List1.ListCount Then
List1.ListIndex = 0
Label1 = List1.List(List1.ListIndex)
End If
Label1.AutoSize = True
Label1.Font.Size = 48
Label2.AutoSize = True
Label2.Font.Size = 72
Label2.Font.Name = "Arial"
Label2.Visible = False
Timer1.Interval = 800
Timer1.Enabled = True
End Sub
Private Sub Label1_Click()
Label2 = List1.ItemData(List1.ListIndex)
Label2.Visible = True
Label2.ForeColor = IIf(Label2 >= "85", vbRed, vbBlack)
Timer1.Enabled = False
Timer1.Interval = 3000
Timer1.Enabled = True
End SubPrivate Sub Timer1_Timer() If Timer1.Interval > 800 Then
Label2.Visible = False
Timer1.Enabled = False
Timer1.Interval = 800
Timer1.Enabled = True
End If If List1.ListIndex < List1.ListCount - 1 Then
List1.ListIndex = List1.ListIndex + 1
Else
List1.ListIndex = 0
End If
Label1 = List1.List(List1.ListIndex)
End Sub
dim mydb as dao.database
for each newtable in mydb.tabledef
'做你想做的
next
mydb.close
...