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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing a report in VB

Status
Not open for further replies.

PauloMongo

Programmer
Jul 16, 2001
80
GB
Hi,

I am looking at running a report and then exporting this out to email, the exporting I have working but can not get the report to refresh. Sorry I am new to this, but please advise what events are needed for this to happen. Here is what I have so far.

'declare the application and report
Dim crxApplication As New CRAXDDRT.Application
Public report As New CRAXDDRT.report

Private Sub CmdClose_Click()

Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Are you sure you wish to exit ?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Exit Export" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
Unload Me ' Perform some action.
End If


'Unload Me

End Sub

Private Sub CmdExport_Click()


report

For i = 1 To report.Database.Tables.Count
report.Database.Tables(i).SetLogOnInfo _
"Commercial Live", "", "sysprogress", "sysprogress"
Next i




With report.ExportOptions
.DestinationType = crEDTEMailMAPI
.FormatType = crEFTExcel80
.MailToList = "p.valentine@uk.intrum.com"
.MailSubject = "This is a test to see how good I am"
.MailMessage = "bunting, you are my bitch"
.DiskFileName = App.Path & "\Exportrpt.xls"
End With

report.Export False

'CRViewer1.ReportSource = report
'CRViewer1.ViewReport

End Sub

Private Sub Form_Load()

Set report = crxApplication.OpenReport(App.Path & "\exportrpt.rpt")

'Screen.MousePointer = vbHourglass

'Screen.MousePointer = vbDefault



End Sub
 
You need the line...

report.DiscardSavedData

..easy when you know how but terribly difficult to find the information! I found this out by experimentation!

Good Luck.

D.

"I want to play..."
(Guess the X-Files episode!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top