Private Sub Command1_Click()
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Conn.Open connstring ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & “数据库的路径和名字” & ";Persist Security Info=True;Jet OLEDB:Database Password= & "数据库密码"
sql = "Select * From “ & ”表名" & where ID=20"
Rs.Open sql, Conn, 1, 3
If NOT rs.eof then
m_date= rs("日期型字段的名字")
m_data= rs("数值型字段的名字")
end if
end sub
Access的数据透视功能比Excel还要强悍一些。值得学习掌握~