I read the article about the memory leak - below is the code I use to read my Access table(s) - so I guess I am going to run into the memory problem. Can you suggest another method of connecting to Access or SQL for that matter.
Is there a way I can monitor the amount of free memory - in the olden days the 'Free' command fullfilled that purpose - But I am not sure what replaces that command.
Code:
Public Sub FindFirstLastDates(strDBPath As String, DB_PW As String)
Dim adoConn As Object
Dim rstRec As Object
Set adoConn = CreateObject("ADODB.Connection")
Set rstRec = CreateObject("ADODB.Recordset")
strTable = "SampleHeader"
On Error Resume Next
With adoConn
Err.Clear
.provider = "Microsoft.Jet.Oledb.4.0"
.Properties("Jet OLEDB:Database Password") = DB_PW
.Open "Data Source=" & strDBPath
If Err.Number <> 0 Then
On Error GoTo 0
Exit Sub
End If
End With
rstRec.Open "Select * from " & strTable & " ORDER BY SampleDateTime", adoConn, 3, 3
rstRec.movefirst
TxtStartDate.Text = Format(rstRec.fields("SampleDateTime"), "YYYY/MM/DD")
rstRec.movelast
TxtEndDate.Text = Format(rstRec.fields("SampleDateTime"), "YYYY/MM/DD")
adoConn.Close
On Error GoTo 0
End Sub
Bookmarks