Set db = OpenDatabase(dbname)
    Set qdef = db.CreateQueryDef("", _
        "SELECT Year, Value FROM YearlyValues")
    Set rs = qdef.OpenRecordset(dbOpenSnapshot)
    rs.MoveLast
    NumPoints = rs.RecordCount
    ReDim Values(1 To NumPoints, 1 To 2)
  rs.MoveFirst
    For i = 1 To NumPoints
        Values(i, 1) = Format$(rs!Year, "yyyy")
        Values(i, 2) = rs!Value
        rs.MoveNext
    Next i
这是一段用machart生成图像时的数据读取,我不懂rs 后面的!是什么意思?如果我不想直接使用字段名,而是想用文本框中的文本代替,如text1.text 代替,应该如何修改 Values(i, 1) = Format$(rs!Year, "yyyy")
        Values(i, 2) = rs!Value

解决方案 »

  1.   

    For i = 1 To Text1.count
            Values(i, 1) = Format$(rs!Year, "yyyy")
            Values(i, 2) = Text1(i).text
        Next i
      

  2.   

    For i = 1 To Text1.count
            Values(i, 1) = Format$(Text1(i).text, "yyyy")
            Values(i, 2) = Text1(i).text
        Next i
      

  3.   

    For i = 1 To NumPoints
       Values(i, 1) =rs.FieldsCombo3.Text).Value            
       Values(i, 2) = rs.Fields(Combo2.Text).Value         
       rs.MoveNext    
        Next i
     我自己解决好了。