Question : Need advice on approach: one recordset, or multiple recordsets?

Fellow Experts,

One of my banking clients uses an Access database app I developed for them to facilitate scheduling and reporting in their rather large branch network.  I have to develop a new report for them that basically creates, for each branch, a report that will look similar to the mock-up attached here.  The report will be deployed as Excel files, one for each branch.

Since this project requires integration between Access and Excel, I am asking for Experts in both zones to weigh in.

I will have the data needed to populate the report, and I do not need help with the SQL for the queries.  What I do need is advice on the approach for taking the query data and getting them into the Excel workbooks.  The approaches I am considering are:

1) Open 7 recordsets for each branch, one for each day of the week.  Each recordset would have the Lobby and Drive-Up counts for its particular weekday.  I would then use Excel's CopyFromRecordset method to move the data into Excel

2) Open 1 big recordset for all branches and all days, loop through that recordset, and populate Excel one cell at a time

Method #1 should be faster at populating Excel, but having to open and close 7 recordsets for each branch, when the users could be doing this for several hundred branches at a time, worries me a little.  Method #2 might be faster on the Access side, but then we have a potentially rather large recordset held in memory, plus Excel can be slow when you have to populate one cell at a time.

I would appreciate your opinions before I get started with the work in earnest, most especially if you see other approaches that might make more sense.

Cheers, and thanks,

Patrick

Answer : Need advice on approach: one recordset, or multiple recordsets?

Patrick...

This might help you....This is what i do if i a large database and lot of values to copy...then what i do...is i create my own select temp query...passing on my varaibles through excel...and copying the complete query into the range rather then one cell as doing calcualtions in access is faster...

for instance here is a part of my temp query for one of the reports that i make...may be this might help you...
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
Dim A As Object
Dim MyAccess As Database
Dim MyQuery As String
Dim MyNewQuery
Dim MyTemp As DAO.Recordset
Dim xSelect As String
 
 
 
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.StatusBar = "Importing Data From Access"
 
Sheets("Import").Visible = True
 
 
 
xdate = [dDate]
 
Smonthdate = Sheet5.Cells(5, 6)
Emonthdate = Sheet5.Cells(5, 7)
 
With Application
        .Calculation = xlManual
        .MaxChange = 0.001
    End With
    ActiveWorkbook.PrecisionAsDisplayed = False
    
Sheets("Import").Select
Range("AST").Select
Selection.ClearContents
 
 
Set MyAccess = OpenDatabase("database path")
 
xSelect = " SELECT Ttable.Agent_Name, Ttable.Login_Id, Sum(Ttable.STime) AS SumOfSTime, Sum(Ttable.AXTime) AS SumOfAXTime, Sum(Ttable.[0Time]) AS SumOf0Time, Sum(Ttable.PBTime) AS SumOfPBTime, Sum(Ttable.DBTime) AS SumOfDBTime, Sum(Ttable.MTime) AS SumOfMTime, Sum(Ttable.TTime) AS SumOfTTime, Sum(Ttable.ITTime) AS SumOfITTime, Sum(Ttable.TETime) AS SumOfTETime, Sum(Ttable.PRTime) AS SumOfPRTime, Sum(Ttable.B1Time) AS SumOfB1Time, Sum(Ttable.B2Time) AS SumOfB2Time " & _
            "FROM Ttable " & _
            "WHERE (((Ttable.DATE)>=" & CDbl(Smonthdate) & " And (Ttable.DATE)<=" & CDbl(Emonthdate) & ")) " & _
            "GROUP BY Ttable.Agent_Name, Ttable.Login_Id;"
            
On Error Resume Next
MyAccess.QueryDefs.Delete ("Temp1")
On Error GoTo 0
Set MyNewQuery = MyAccess.CreateQueryDef("Temp1", xSelect)
Set MyTemp = MyAccess.OpenRecordset("Temp1")
 
'**********Importing From Access**********
Sheets("Import").Select
Range("AST").Select
Selection.CopyFromRecordset MyTemp
MyAccess.QueryDefs.Delete ("Temp1")
Random Solutions  
 
programming4us programming4us