RE: [pro_vb] Re: Difference between Left and Left$ functionsDear Experts,
i am using craxddrt.dll as a ref. in VB to view crystal's .rpt file
in default internet browser (for me it is ie6). craxddrt.dll file comes with
RDC or Crystal 8. I am using password protected mdb file ( ms access's
file). To view .rpt file i am using some code to export file in .html format
and then i am using shellexecute API to view that file.
Now problem is that if i am using MDB file without any password following
code works fine but if it is password protected then it gives 'OPEN SESSION
ERROR'.
Have u solution of this? looking forward for your reply.
'**************
Dim crxApp As CRAXDDRT.Application
Dim Rpt As CRAXDDRT.Report
Set crxApp = New CRAXDDRT.Application
Set Rpt = crxApp.OpenReport(App.Path &
"\Reports\extensionwisedetail.rpt")
With Rpt
.FormulaSyntax = crCrystalSyntaxFormula
'MsgBox .FormulaFields.Count
' Dim i
' For i = 1 To .FormulaFields.Count
' Debug.Print i & "] " & .FormulaFields(i).Name & " - " &
.FormulaFields(i).Value
' Next
'.FormulaFields.Item(3).Text = "{@CompanyName} ='" & CompanyName
& "'"
'.Database.SetDataSource
'.RecordSelectionFormula = "" ' this is like
cry.selectionformula
.FormulaFields.Item(3).Text = "'" & CompanyName & "'"
.FormulaFields.Item(4).Text = "'" & CompanyCityName & "'"
.FormulaFields.Item(5).Text = "'Extensionwise Detail Report '"
.FormulaFields.Item(14).Text = "' Local/Long
Distance/International/Group Calls '"
Dim strDateRange As String
strDateRange = "From " & Now & " To " & DateAdd("d", 7, Now)
.FormulaFields.Item(15).Text = "'" & strDateRange & "'"
.Database.SetDataSource ("C:\zlink.mdb")
.DisplayProgressDialog = False
.DiscardSavedData
.EnableParameterPrompting = False
With .ExportOptions
.DestinationType = crEDTDiskFile
.FormatType = crEFTHTML40
.HTMLFileName
"c:\windows\desktop\extensionwisedetail.html"
'' To mail .html file.....
'.DestinationType = crEDTEMailMAPI
'.FormatType = crEFTHTML40
'.HTMLFileName
"c:\windows\desktop\extensionwisedetail.html"
'.MailToList = "ashutosh_mehta@g..."
'.MailCcList = "nayan_joshi@g..."
'.MailSubject = "Extensionwise Detail Report"
'.MailMessage = "This is our first report in Mapi"
End With
.Export False
End With
Set crxApp = Nothing
Set Rpt = Nothing
Dim Ret
Ret = ShellExecute(Me.hWnd, vbNullString,
"c:\windows\desktop\extensionwisedetail.html", vbNullString, vbNullString,
SW_SHOWMAXIMIZED)
Debug.Print "Shell Ret : " & Ret & " Time : " & Time
'**************
For,GATES
Ashutosh Mehta
<< Risk taking is essential to progress, and failure is often a key part of
learning >>