Link to home
Start Free TrialLog in
Avatar of busugrilla
busugrillaFlag for Malta

asked on

Invalid directory

I am trying to develop VB6 SP6 application using Crystal reports 8 on a Windows 7 32-bit host OS.
When I try to export a report I keep getting Invalid Directory error from Crystal and the export fails.
Can any body help ?  Thanks
Avatar of VBClassicGuy
VBClassicGuy
Flag of United States of America image

Win7 is very picky about where you place files. What is the full path to the exported file?
Avatar of Mike McCracken
Mike McCracken

How are you exporting?
Through code or a viewer?

Can you view a report?

Is this a client application or server based?

Do you have permissions to the temp directories?

Where are you trying to put the report?

How do you pick the directory?
Navigate to it?

What code are you using to view/export the report?

mlmcc
Avatar of busugrilla

ASKER

Reply to VBClassicGuy:
path is D:\SOL Trial\crleavetotals1.xls

Reply to mlmcc:
I am exporting both through code and through viewer.
When from code xls file is created but empty.
When from viewer the windows Save As dialog box hangs up.
Yes I can view the report successfully.
It is a Client app.
What are the temp directories please ?
path is D:\SOL Trial\crleavetotals1.xls
From windows Save As dialog box.
First time yes I navigate to directory, then on subsequent attempts correct directory is displayed in the Save As dialog.
Please see code attached.
Public Sub ProcessReport8(pConn As Connection, pstrStoredProc As String, pReport As String, pReportName As String, Optional pOrientation As Integer = crPortrait, Optional pPaperSize As Integer = crPaperA4)

    Dim rst As New adodb.Recordset
    Dim CRXApplication As New CRAXDRT.Application
    Dim CRXReport As New CRAXDRT.Report
    
    'On Error Resume Next
    rst.Open pstrStoredProc, pConn, adOpenKeyset
    
    Set CRXReport = CRXApplication.OpenReport(pReport, 1)
    
    CRXReport.Database.SetDataSource rst
    CRXReport.PaperOrientation = pOrientation
    CRXReport.PaperSize = pPaperSize
    CRXReport.Database.Verify
   
   
    frmReportViewer.Caption = pReportName
    frmReportViewer.CRViewer1.DisplayGroupTree = False
    frmReportViewer.CRViewer1.ReportSource = CRXReport
    frmReportViewer.CRViewer1.ViewReport
    frmReportViewer.Show vbModal
    Set frmReportViewer = Nothing
    
    Set CRXApplication = Nothing
    Set CRXReport = Nothing
    
End Sub

Public Sub ExportReport8(pConn As Connection, pstrStoredProc As String, pReport As String, pReportName As String)
    
    Dim rst As New adodb.Recordset
    Dim CRXApplication As New CRAXDRT.Application
    Dim CRXReport As New CRAXDRT.Report
        
    rst.Open pstrStoredProc, pConn, adOpenKeyset
    
    Set CRXReport = CRXApplication.OpenReport(pReport, 1)
    
    CRXReport.Database.SetDataSource rst
    CRXReport.Database.Verify
    CRXReport.Export True
   
    Set CRXApplication = Nothing
    Set CRXReport = Nothing
   
End Sub

Open in new window

Try using a directory without the SPACE in the name.  CR8 was written for Win95 and I recall there were initially issues with directoy and file names with spaces.

mlmcc
ASKER CERTIFIED SOLUTION
Avatar of busugrilla
busugrilla
Flag of Malta image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
By simply using a higher version of Crystal Reports the report export problem was solved.
Did you try exporting toa directory with no spaces in the name?

I recall having tht as an issue when we used CR7 and 8.

mlmcc
To mlmcc:

Yes I tried as you suggested, with no spaces in the directory and file names but still no joy.

Thanks alot for your help.