Results 1 to 2 of 2

Thread: error viewing crystal reports from vb package after i deploy it

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    17

    error viewing crystal reports from vb package after i deploy it

    hello gurus,
    i had problem accessing secured database in crystal reports in my Visual Basic application i successfully did it after all the help from this forum now i am having a small problem

    what i have done is that i used same line of code in all forms but changed the report source to report1 , report 2 , report3 respectively rest all lines are same
    its running well in development envt but when i run it after installing the first report runs well while i click on next report it gives error memory referrenced ..click ok to terminate program or cancel to debug it..

    plz help me where i am faltering..
    i have added crystal reports report1 report 2 and report3 to my package as well while making deployment package...

    help me its urgent

    Private m_App As New CRAXDDRT.Application
    Private m_Rep As New CRAXDDRT.Report
    Public mRepName As String
    Public mstrW As String
    Dim strw As String
    Public mstrUName As String
    Public msRepTitle As String

    Private Sub Command1_Click()

    If List1.Text = "" Then
    MsgBox ("Select Job No")
    Exit Sub
    Else
    If dtp1.Value = "" And dtp2.Value = "" Then
    MsgBox ("Select Dates from two Calendars")
    Exit Sub
    Else

    'strW = "{assignjob.cusname} = '" & cboStudyAreas.Text & ""
    ''to use''''''''mstrW = "{ customerdetails.csno} = 9 "
    Dim ConnectionInfo As CRAXDDRT.ConnectionProperties
    Dim test As String

    mRepName = App.Path & "\report1.rpt"
    test = App.Path & "\ proj1.mdb"

    Set m_Rep = m_App.OpenReport(mRepName, 1)
    m_Rep.RecordSelectionFormula = mstrW
    Dim nm As String
    nm = List1.Text
    Dim dt1 As String
    Dim dt2 As String
    dt1 = Format(dtp1.Value, "yyyy,mm,dd,0,0,0")
    dt2 = Format(dtp2.Value, "yyyy,mm,dd,0,0,0")
    strw = "{assignjob.jobno} = '" & List1.Text & "' and {assignjob.releaseddate} in DateTime (" & dt1 & ") to DateTime (" & dt2 & ")"

    Set ConnectionInfo = m_Rep.Database.Tables(1).ConnectionProperties
    'On Error Resume Next
    m_Rep.Database.Tables(1).DllName = "crdb_dao.dll"
    Set ConnectionInfo = m_Rep.Database.Tables(2).ConnectionProperties
    m_Rep.Database.Tables(2).DllName = "crdb_dao.dll"
    ConnectionInfo.DeleteAll
    ConnectionInfo.Add "proj.mdb", test
    ConnectionInfo.Add "session UserID", "admin"
    ConnectionInfo.Add "Session Password", "dips"


    Form1.mstrW = strw
    List1.Visible = False
    Command1.Visible = False
    CRViewer91.ReportSource = m_Rep
    'CRViewer91.Visible = True
    Command2.Visible = True
    CRViewer91.ViewReport
    CRViewer91.Zoom 1
    CRViewer91.Top = 0
    CRViewer91.Left = 0
    CRViewer91.Height = ScaleHeight
    CRViewer91.Width = ScaleWidth
    Set m_Rep = Nothing
    End If
    End If
    End Sub



    Private Sub Command2_Click()
    main.Show
    Unload Me
    End Sub

    Private Sub Form_Load()

    CRViewer91.Visible = False
    Command2.Visible = False
    Set cn = New ADODB.Connection
    With cn
    .Provider = "microsoft.jet.oledb.4.0"
    .Properties("jet oledb:database password") = "dips"
    .Open App.Path & "\proj.mdb"
    End With
    Set rs1 = New ADODB.Recordset
    sql1 = "select distinct jobno from jobassign"
    rs1.Open sql1, cn, adOpenDynamic, adLockOptimistic
    List1.Visible = True
    rs1.MoveFirst
    Do Until rs1.EOF
    List1.AddItem (rs1.Fields(0))
    rs1.MoveNext
    Loop
    rs1.Close
    cn.Close
    End Sub

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: error viewing crystal reports from vb package after i deploy it

    You need to manually add the CR references and dependancies to you setup package. Use the Runtime.hlp help file to determine which ones to add depending on your code and ocx's added.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width