I need help with this - I am updating a VB6 program to Visual Studio 2008. What I need to do in VS2008 is:
- Open Crystal Report
- log into Crystal Report
-set the format
-save Crystal Report as text.
Here is the code in VB6. I'm new for VS2008 so I am having a hard time figuring this out.
Thank you for your help!
Dim crxApp As New CRAXDRT.Application
Dim crxRpt As CRAXDRT.Report
Dim strRpt() As String
Dim intRpt As Integer
Dim dtFirst, dtEnd As Date
Dim cn As New ADODB.Connection
cn.ConnectionString = "myconnectionstring"
cn.Open
'Print daily scrap reports
Select Case DatePart("w", Date)
Case 2, 3, 4, 5, 6
ReDim strRpt(3)
intRpt = 1
strRpt(1) = "Y:\MP\REPORTS\REPORT1"
strRpt(2) = "Y:\MP\REPORTS\REPORT2"
strRpt(3) = "Y:\MP\REPORTS\REPORT3"
'Print daily scrap reports
For intRpt = 1 To 3
Set crxRpt = crxApp.OpenReport(strRpt(intRpt) & ".rpt")
crxRpt.Database.Tables(1).SetLogOnInfo "mylogoninfo" (can't figure out how to do this part in VS2008)
crxRpt.ReadRecords
crxRpt.DisplayProgressDialog = False
With crxRpt.ExportOptions (how do I set the export options)
.FormatType = crEFTPaginatedText
.UseDefaultCharactersPerInch = False
.UserDefinedCharactersPerInch = 10
.NumberOfLinesPerPage = 67
.DestinationType = crEDTDiskFile
.DiskFileName = strRpt(intRpt) & ".txt"
End With
crxRpt.Export (False)
Next intRpt