看看吧.应该对你有用.
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As New
sconstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "I:\curing\" & riqi1 & "\" & rs4!机台号 & "-" & rs4!日期 & ".mdb"
con.Open sconstr
If con.State = 1 Then
cmd.ActiveConnection = con
= "select 左胎号,右胎号 from aa where 左胎号<>''and 右胎号<>''order by 时间 "
Set rs = cmd.Execute
End If
rs.MoveFirst
i = 0
Do While Not rs.EOF
n(i, 1) = rs!右胎号
n(i, 2) = rs!左胎号
rs.MoveNext
i = i + 1
Loop
MsgBox "本表左右胎号不为空的记录数为:" & i & "条."
rs.Close
con.close