MS Acess无效或不合格的参考

时间:2015-07-11 17:37:58

标签: excel vba ms-access

目前我正在使用从excel导入外部数据的Access工作。当我试图超出该值时,我获得无效或不合格的参考

Excel表格中可用的列: -

  1. GROUP_NUMBER
  2. CARD_NUMBER
  3. 以下是我到目前为止尝试的代码: -

    qry = "SELECT * FROM " & _
          "tbl_mainframe "
    
    Set rst = CurrentDb.OpenRecordset(qry)
    
    rst.MoveLast
    total_record = rst.RecordCount
    rst.MoveFirst
    
    For i = 0 To total_record - 1
    MsgBox (Nz(!Card_Number)) - > **Error**
    rst.MoveNext
    Next i
    rst.Close
    

    请告知。

1 个答案:

答案 0 :(得分:1)

这应该有效 qry = "SELECT * FROM tbl_mainframe" Set rst = CurrentDb.OpenRecordset(qry) do While not rst.Eof MsgBox (Nz(rst!Card_Number)) rst.MoveNext Loop rst.Close