Hi Friends,

i`ll use font end VB6.0 back end Ms Access And using Crystal Report 8.5

i ll attached database to report and result also fine, but suppose change my application path(Folder) to another path(Folder) reports can`t displayed. so i need how to apply for database application path in to Crystal reports..

8 Years
Discussion Span
Last Post by hell_tej

In VB use Crystal Report Viewer Tool to Displaying Report.
It can Support Multiple Path means whenever you change your DB path in the TOOL form, it autometicaly connect to your database.
use following code into the form which contain the Crystal Report Tool

Option Explicit
Dim cn As New ADODB.Connection
Dim rpt As CRAXDRT.Report
Dim db As CRAXDRT.Database
Dim rs As New ADODB.Recordset
Dim WithEvents sect As CRAXDRT.Section

'Heaven Production Software codes Contect No:- 9376641505 
Private Sub Form_Load()
If cn.State = 1 Then cn.Close
cn.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Persist Security Info=True"
Screen.MousePointer = vbHourglass
' Path Exits or not
If Dir(App.Path & "\Selection.rpt") <> "" Then
Set rpt = crx.OpenReport(App.Path & "\Report3.rpt")
Set rpt = crx.OpenReport("D:\UJF\Report3.rpt")
End If

Set db = rpt.Database
On Error GoTo solve

If rs.State = 1 Then rs.Close
rs.Open "SELECT * FROM compinfo", cn, 1, 1
rpt.Database.SetDataSource rs, 3, 1
CRViewer1.ReportSource = rpt
CRViewer1.Zoom 1
Screen.MousePointer = vbDefault
  If Err.Number = 445 Then
   On Error GoTo solve
   MsgBox "You Create an Crytical Manupletion", vbCritical, " :: Managment Help :: "
  End If
End Sub
'Heaven Production Software codes Contect No:- 9376641505
Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
End Sub
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.