I am new to crystal reports. And am using Crystal reports 9 with VB6 and an access Database.
I have my report designed an it is displaying the data in a cross tab.
It is displaying 3 fields from my database, and is displaying ALL the data from those fields.
I need to filter it down by date. In
VB, the user will select two dates from DTPicker controls, then when they click a button to show the report, the report should only contain data BETWEEN those two dates.
I have no idea how to do this.
The date field in the DB is called "DateFinished".
I then have to send this report automatically by email. which isnt working either, it works once, then doesnt work after that.
Here is the code I am using:
visual basic code:--------------------------------------------------------------------------------
' this exports the report to PDF format automatically.
Dim pathname As String
pathname = "C:\VB_Projects\MICRO_LAB\REPORTS\Micro1.rpt"
' Use the .OpenReport method of the Application object to set your Report object to a RPT file
Set crxReport = crxApplication.OpenReport(pathname)
' Use the DiscardSavedData method to ensure that your report hits the Database and refreshes the data
crxReport.DiscardSavedData
Screen.MousePointer = vbHourglass
Form3.Show
crxReport.ExportOptions.FormatType = crEFTPortableDocFormat
crxReport.ExportOptions.DestinationType = crEDTDiskFile
crxReport.ExportOptions.DiskFileName = "C:\VB_Projects\MICRO_LAB\REPORTS\Micro1.pdf"
crxReport.ExportOptions.PDFExportAllPages = True
crxReport.Export (False)
Screen.MousePointer = vbDefault
' email the report using this code: works only once
'Set CrystalOptions = crxReport.ExportOptions
crxReport.ExportOptions.FormatType = crEFTPortableDocFormat
crxReport.ExportOptions.DestinationType = crEDTEMailMAPI
'crxReport.ExportOptions.PDFExportAllPages = True
crxReport.ExportOptions.MailSubject = "Testing Report Export via Email"
crxReport.ExportOptions.MailMessage = "Here is the latest Micro Report"
crxReport.ExportOptions.MailToList = "
[email protected]"
crxReport.Export (False)
--------------------------------------------------------------------------------
Thx for any help.