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

crpeExportToDisk returns false with no errors

Status
Not open for further replies.

blocktl

Programmer
Jun 18, 2003
14
US
Below is a piece of code I wrote to execute a crystal report and export a character separated text file. I get no errors, but I also get no results. Any suggestions?

Private Sub cmdExport_Click()

Dim Result As Integer
Dim MainJob As Integer
Dim UseSameNumberFormat As Integer
Dim UseSameDateFormat As Integer
Dim StringDelimiter As String
Dim FieldDelimiter As String
Dim TheFileName As String
Dim crApp As New CRAXDRT.Application
Dim crRpt As CRAXDRT.Report
Dim StartRange As String
Dim EndRange As String
Dim TheBank As String
Dim Record_Selection As String

UseSameNumberFormat = 1
UseSameDateFormat = 1
StringDelimiter = ""
FieldDelimiter = ","
StartRange = txtStart.Text
EndRange = txtEnd.Text
TheBank = cboBank.Text

TheFileName = cboApp.Text & txtStart.Text & "-" & txtEnd.Text

' Open print engine
Result = PEOpenEngine()

' Open the selected report
MainJob = PEOpenPrintJob("ReportNamePath" & vbNullChar)

' Set the record selection criteria
Set crRpt = crApp.OpenReport("ReportNamePath")
Record_Selection = &quot;{Chk_No} >= &quot; & StartRange & &quot; and {Chk_No} <= &quot; & EndRange & &quot; and {Bank_Id}= '&quot; & TheBank & &quot;'&quot;
Record_Selection = Replace(Record_Selection, &quot;'&quot;, &quot;&quot;&quot;&quot;)
crRpt.RecordSelectionFormula = Record_Selection

' Set export options based on selected export destination
Result = crPEExportToDisk(MainJob, &quot;ExportPath&quot; & TheFileName & &quot;.txt&quot; & vbNullChar, &quot;u2fsepv.dll&quot; & vbNullChar, crUXFCharSeparatedType, UseSameNumberFormat, UseSameDateFormat, StringDelimiter & vbNullChar, FieldDelimiter & vbNullChar)

' Start the print job
Result = PEStartPrintJob(MainJob, 1)

' Close the print job
PEClosePrintJob (MainJob)

' Close the engine
PECloseEngine

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top