-
Big Time Help Needed
Trying to get a vb app to spit out an XLS file using crystal reports.
Works fine when I run it, but my user account has access to all tables and databases.
So I 've created a new user that has same rights as I do and I need to pass these parameters to the Crystal Report.
Below is how I am doing it and I am getting a '
Failed to Open the connection' error.
Any ideas as to what I can do?
Thanks in advance.
Public Sub Export2XLS()
Dim sDestinationPath As String
sDestinationPath = destination path
'Open the report
Set CrystalReport = CrystalApp.OpenReport(rptpath)
With CrystalReport.Database
.LogOnServer "PDSODBC.DLL", "SCOPACESQLP1", "crystal", "VBapp_2006", "PACE_VBpw1"
End With
Set CrystalExportOptions = CrystalReport.ExportOptions
DoEvents
CrystalExportOptions.ExcelMaintainColumnAlignment = True
DoEvents
CrystalExportOptions.ExcelConstantColumnWidth = 500
DoEvents
CrystalExportOptions.FormatType = crEFTExcel80
DoEvents
CrystalExportOptions.ExcelPageBreaks = False
DoEvents
CrystalExportOptions.DestinationType = crEDTDiskFile
DoEvents
CrystalExportOptions.DiskFileName = sDestinationPath
'Export the report without prompting the user
DoEvents
CrystalReport.Export False
End Sub