title: Loop through Access database and perform basic operations using Excel VBA
body: <p>I have been performing these operations through excel, but the raw data that I am dealing with is overwhelming for excel. I shifted over to access as the database but I am trying to find similar functionality. I am still using excel as my interface. </p>
  
  <p>I am essintially breaking my data into samples. Taking a sample of the data, analyzing it then moving on to the next sample. I would like to do the same with the Access data. What I am looking for is how to perform operations (summation, multipication, division,max, min...) on a sample using a for loop. Also, what is the ID of max value and ID on the min value. I am also dealing with a huge amout of raw data, so the less lines of code would be optimal. Any pointers in the right direction would be appreciated. </p>
  
  <p>Code in Excel:</p>
  
  <pre><code>For CoUnTer = 1 To FindRecordCount
  
          Set Circ_Rng = WS.Range(WS.Cells(CoUnTer , 5), WS.Cells(CoUnTer  + TempTimeFrame - 1, 5))
          Set DataPoint_Rng = WS.Range(WS.Cells(CoUnTer , 1), WS.Cells(CoUnTer  + TempTimeFrame - 1, 1))
          Set DataPoint_Circ_Rng = WS.Range(WS.Cells(CoUnTer , 8), WS.Cells(CoUnTer  + TempTimeFrame - 1, 8))
          Set DataPoint_SQ_Rng = WS.Range(WS.Cells(CoUnTer , 9), WS.Cells(CoUnTer  + TempTimeFrame - 1, 9))
          '---------------------------
          MaxPoint = WorksheetFunction.Max(CircPressure_Rng)
          Row_At_MaxPressure = WS.Columns(5).Cells.Find(MaxPoint, After:=WS.Cells(3, 5), SearchOrder:=xlByRows, LookIn:=xlValues, SearchDirection:=xlNext).Row
  
      Sigma_X_Sigma_Y = WorksheetFunction.Sum(Circ_Rng) * WorksheetFunction.Sum(DataPoint_Rng)
      Sigma_XY = WorksheetFunction.Sum(DataPoint_Circ_Rng)
      Sigma_X2 = WorksheetFunction.Sum(DataPoint_SQ_Rng)
      Min_X = WorksheetFunction.Min(DataPoint_Rng)
  </code></pre>
  
  <p>Code for Access data:
  This code gets the data sample. What I am missing how can I handle the operations on them similar to what I have done in excel. </p>
  
  <pre><code>Sub GetAccessData()
  
  
  Dim DBFullName As String
  Dim Connect As String, Source As String
  Dim Connection As ADODB.Connection
  Dim Recordset As ADODB.Recordset
  Dim Col As Long
  Dim x As Long
  Application.ScreenUpdating = False
  
  'DataBase Path
  DBFullName = WB_Path &amp; "\RawData - Template.accdb"
  
  'Open the Connection
  Set Connection = New ADODB.Connection
  Connect = "Provider=Microsoft.ACE.OLEDB.12.0;"
  Connect = Connect &amp; "Data Source=" &amp; DBFullName &amp; ";"
  Connection.Open ConnectionString:=Connect
  
  'Create a RecordSet
  Set Recordset = New ADODB.Recordset
  ' Client-side cursor
  Recordset.CursorLocation = adUseClient
  
  With Recordset
      Source = "SELECT * FROM  RawData WHERE [ID] BETWEEN " &amp; StartofData &amp; " AND " &amp; EndofData
      .Open Source:=Source, ActiveConnection:=Connection
      On Error Resume Next
  
  End With
  EndofData = Recordset.RecordCount
  
  Set Recordset = Nothing
  Connection.Close
  Set Connection = Nothing
  'Application.ScreenUpdating = True
  'Application.EnableEvents = True
  
  End Sub
  </code></pre>