In the program writing, I am passing a selection formula to a Crystal Reports 7 (using the Crystal Reports OCX) report. This selection is based on information gathered and stored in an Access97 working table. The old data is cleared from the table prior to each call for the report. The problem I am having is that after displaying/printing the report the first time, repeated calls to display the report do not refresh the data. I included the refresh button on the report display so that the user can refresh the report manually. This seems to be a particular trait of Crystal Reports 7, as I did not have that problem with Versions 5 & 6. Is there a way to have the report refreshed automatically each time it is called? Below is the code I have on my Print button.
strDateTime = Str(Now)
FillWorkTable strDateTime
With frmMain.CrystalReport1
.DataFiles(0) = gdbLocation & C_DBNAME
.ReportFileName = App.Path & "\Reports\rptShortListQueryBy.rpt"
.SelectionFormula = "{wtblPersonal.UserID} = " & glngUserID & " AND {wtblPersonal.DateTime} = " & QuoteSingle(strDateTime)
.Formulas(0) = "QueryBy= " & Quote(gstrQueryBy)
.WindowShowExportBtn = False
.WindowShowRefreshBtn = True
.WindowShowSearchBtn = False
.Destination = crptToWindow
.WindowState = crptMaximized
End With
If frmMain.CrystalReport1.PrintReport <> 0 Then
gstrProcedure = "Crystal Report Error - " & frmMain.CrystalReport1.LastErrorNumber & " - " & frmMain.CrystalReport1.LastErrorString
LogErrors gstrProcedure
MsgBox gstrProcedure
End If
Any help that you may provide to solve this problem will be greatly appreciated.
Tommy
