2015년 1월 26일 월요일

[액세스VBA] 레코드 갯수(record count)

Private Sub Command1_Click()
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
 
    Dim rsCount As Integer
    Dim queryNameOrSQL As String
 
    queryNameOrSQL = "select * from excel"
 
    Set db = CurrentDb
    Set rs = db.OpenRecordset(queryNameOrSQL)
    rs.MoveLast
 
    rsCount = rs.recordCount

    Text1.Value = rsCount
End Sub



excel : 테이블 이름(table name)

댓글 없음:

댓글 쓰기