Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating data on a .DSR report

Status
Not open for further replies.

Beaner5434

Programmer
Jul 18, 2001
12
US
I have developed a VB5 app which uses a .dsr report and the CRViewer. The user has the option of selecting two dates to compare on the VB5 form, then printing the results via the .DSR report. The following code is used when opening the form that contains the CRViewer control:

-------------------------------------------------
Option Explicit
Dim Report As New rptDooley
Dim DAOSnap As DAO.Recordset
Dim DAODb As DAO.Database
Dim wrkJet As Workspace

Private Sub Form_Load()
Dim sForm As String

Screen.MousePointer = vbHourglass
' Create a Microsoft Jet workspace
Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
' Set the location of the database here
Set DAODb = wrkJet.OpenDatabase(dbMerger)
' Create the recordset off the designated Date fields,
sForm = "SELECT DooleyTemp.* From DooleyTemp "
sForm = sForm & "ORDER BY DooleyTemp.SummaryGroup;"
Set DAOSnap = DAODb.OpenRecordset(sForm)
Report.Database.SetDataSource DAOSnap
Report.ReadRecords
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set wrkJet = Nothing
Set DAODb = Nothing
Set DAOSnap = Nothing
Report.DiscardSavedData
Set Report = Nothing

End Sub
-------------------------------------------------
When I click the report button on the dialog form, it opens the report and shows the last data set displayed. If I then simply close the report form and reopen it, it shows the data the user has selected. I've tried putting the Report.DiscardSavedData at the start of the Form_Load event, after the report has been displayed, and when the form is closed, but it makes no difference; I have to open, close, and then reopen the report in order to display the information I want. I know it has to be something simple, but I am clueless at this point, and I am hoping one of you can help me out with this little glitch.

TIA for your assistance!

 
Follow-up on this issue... I went into the report and clicked the refresh button. The report went blank. When I closed the form and opened it again, the correct data is there. I know the correct data is in the Access 97 backend database; I went in and looked to see what was there when the incorrect info was being displayed on the report.

Hmmmm....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top