Results 1 to 3 of 3
  1. #1
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: No. of records in table? (Access2k)

    Hi,
    From your code, I assume there's nothing in the table prior to the import? If that's the case, using rst.recordcount should get you the number of records imported.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  2. #2
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: No. of records in table? (Access2k)

    Done it using the following codes:
    strMessage = rst.RecordCount & " Records have been imported "
    MsgBox strMessage
    <img src=/S/joy.gif border=0 alt=joy width=23 height=23>

  3. #3
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    No. of records in table? (Access2k)

    Is there any way I could count the no of records in a table and display it by using code??
    I've already got the following code and want to add some code to display how many records have been exported into the table called tblMiscData.
    <pre>Sub ImportMiscData()
    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    'Turn System warnings off
    Application.SetOption "Confirm Action Queries", False
    'Delete table contents
    DoCmd.OpenQuery "DELtblMiscData", acNormal, acEdit
    'Import data
    DoCmd.TransferSpreadsheet acImport, 8, "tblMiscData", "T:TradeAdminSysMiscData.xls", True, ""
    Set db = CodeDb
    Set rst = db.OpenRecordset("tblMiscData")
    If rst.BOF And rst.EOF Then
    MsgBox "Data has not been imported from MiscData.xls, Please check and try again!", _
    vbInformation + vbMsgBoxSetForeground, strMsgTitle
    Else
    MsgBox "Finished importing data!", vbInformation + vbMsgBoxSetForeground, strMsgTitle
    DoCmd.OpenQuery "UpdMiscTT", acNormal, acEdit
    'Add last tnum
    DoCmd.OpenQuery "DELTnum", acNormal, acEdit
    DoCmd.OpenQuery "AppTnum", acNormal, acEdit
    DoCmd.OpenForm "frmTnum", acNormal, "", "", acEdit, acNormal
    End If
    'Turn System warnings on
    Application.SetOption "Confirm Action Queries", True
    End Sub
    </pre>


    Edited by Charlotte to eliminate horizontal scrolling

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •