plusplus,
Thanks for the reply. It didn't work but I caught the idea that the data environment which somehow does the caching of data needs to be updated.
I have been fiddling with the data outside the application using MS Access/VB6 Addins - Visual Data Manager directly. And even reset my PC or manually deletes the records in the table being pointed by the data environment, still the old report data gets retained.
After few days of playing around with all the properties of the data environment, the BEGIN TRANS, COMMIT TRANS and putting a PAUSE using a MSGBOX did the work:
---------------------------------------------------------
'*** Save all data on a daily basis and save to REPODETAILS table
StoreReportDetails dStartDate, dEndDate
'Summarizes data on a weekly basis and save to a REPOSUMMARY table.
StoreReportWeekSummary
'*** Environment using MSjet 4.0 OLE provider with
' SQL command:
' SELECT YearNr, monthnr, weeknr, tagnr, PigAge, pigtype,
' feedcode, feedname,heads, eachmealkg, totalcost,
' totalkg, bags FROM REPOSUMMARY
'------------------------------------------------------
Load dtaEnvPigs
With dtaEnvPigs
'*** Open the dta environment, to prepare begintrans
If .RepoSummary.State = 0 Then .RepoSummary.Open
End If
'*** Force saving of data by committing transactions
dtaEnvPigs.RepoSummary.BeginTrans
dtaEnvPigs.RepoSummary.CommitTrans
'*** Close the environment after loading***
dtaEnvPigs.RepoSummary.Close
'*** Give the provider sufficient delay time to commit trans.
If MsgBox("Press Ok to continue.", vbOKCancel, "Options") = vbCancel Then Exit Sub
End If End With
'***Two reports use this SUB, if isSumReport is true, DataReport1 gets printed.***
If Not isSumReport Then
DataReport1.LeftMargin = 200
DataReport1.ReportWidth = 8865
DataReport1.Width = 9100
DataReport1.Title = IIf(isDiscounted, "Discounted", " ")
If DataReport1.Visible = False Then
DataReport1.Show 1
Else
DataReport4.LeftMargin = 200
DataReport4.ReportWidth = 8865
DataReport4.Width = 9100
If DataReport4.Visible = False Then DataReport4.ShowEnd If
'*** I don't need this trash anymore, unload it.
Unload dtaEnvPigs
Me.MousePointer = vbNormal
dtaRepoSum.Refresh
End Sub