Results 1 to 2 of 2
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,185

    Recordset Count

    Hi Guys, how can i add a line under line xlbottomedge after rsCount

    Then the very next Excel row (rs.Count + 1) = "TOTALS"

    Then column

    popen, psave, fopen and fsave are all strings (path open, File open etc)

    Below is what i have got but doesnt add the totals to excel on the next row after count ???

    Sorry for being naive, i can get quite a lot working but loose myself doing it

    Code:
    Set ApXL = CreateObject("Excel.Application")
    Set xlWB = ApXL.Workbooks.Open(pOpen & fOpen)
    ApXL.ActiveWorkbook.SaveAs pSave & fSave
    ApXL.Workbooks.Open pSave & fSave, True, False
    ApXL.Visible = False
    With xlWB
    .Worksheets(1).Cells(6, 2).CopyFromRecordset rs
    
    
    .Worksheets(1).Cells(rs.RecordCount, 2) = "TOTALS"  'new
    .Worksheets(1).Cells(rs.RecordCount + 1, 5) = TotalNett  'new
    .Worksheets(1).Cells(rs.RecordCount + 1, 6) = TotalVat  'new
    .Worksheets(1).Cells(rs.RecordCount + 1, 7) = TotalAll  'New


  2. #2
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    How are you opening the recordset? Unless you do a
    rs.MoveLast
    rs.MoveFirst

    You won't always get a reliable record count : Have a read here http://allenbrowne.com/ser-29.html
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Filter Recordset by record count
    By jcc285 in forum Programming
    Replies: 14
    Last Post: 12-05-2017, 09:40 AM
  2. Replies: 5
    Last Post: 12-17-2014, 09:51 PM
  3. Count the number of a group in a recordset
    By Ruegen in forum Programming
    Replies: 2
    Last Post: 05-22-2014, 10:41 PM
  4. Replies: 5
    Last Post: 09-14-2012, 04:56 PM
  5. MessageBox Based on Recordset Count
    By Two Gun in forum Forms
    Replies: 3
    Last Post: 12-25-2011, 07:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums