以下是引用bfwz在2005-7-5 18:39:00的发言:
表1如下:
a字段 b字段
110 120
210 220
希望VBA的变量A11=110, B22=220,
请问,怎么写语句?
Dim A() as Integer
Dim B() as Integer
Set con = Application.CurrentProject.Connection
Set rs = CreateObject("ADODB.Recordset")
stSql = "SELECT * FROM [表1]
rs.Open stSql, con, adOpenKeyset, adLockOptimistic
ReDim A(rs.RecordCount - 1)
ReDim B(rs.RecordCount - 1)
For i = 0 To rs.RecordCount - 1
A(i) = CInt(rs![A字段])
B(i) = CInt(rs![B字段])
rs.MoveNext
Next i
rs.Close
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) | Powered by Discuz! X3.3 |