Results 1 to 13 of 13

Thread: please help me.... CR with DSN [RESOLVED]

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2003
    Location
    Hyderabad
    Posts
    46

    please help me.... CR with DSN [RESOLVED]

    Hai...

    I have am working with CR8.5, Access2000 and VB6.0...

    it is Client/Server project...

    I designed.... all reports... based on one system DSN in one of the system... which... represents... D:\Fabric\Fabric.mdb...

    my DSN name is "FabricDSN"... while installing my project in another network... how to proceed with the DSN...

    while calling the reports... i want to display them by getting the data from required folder.... (here one thing is to be discussed... i am having... multiple databases.... in the server.... like Fabric03.mdb, Fabric04.mdb, Fabric02.mdb... so on)

    while working with my project, at the starting i will select my own... firm... , i mean to which database i want to connect...

    1. Now what my problem is;... I have to get my reports... by connecting... to the required database.... (since... all databases, tables, fields.... are identical)?

    2. How to change the data source of the crystal report.... at runtime... and how to refresh...it at the same time...?

    3. is there any way to change the data source of DSN at runtime...from vb?


    I think it is clear....

    thanks in advance...
    Last edited by satyarao; Jul 31st, 2003 at 01:41 AM.
    satyarao

  2. #2

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2003
    Location
    Hyderabad
    Posts
    46
    thank you Ken...

    these articles are slightly related... to my problem... but they are not sufficient enough...

    can you suggest in more descriptive...

    any how thank you for response...
    satyarao

  4. #4
    Addicted Member
    Join Date
    Apr 1999
    Posts
    178
    I don't use DSN to connect to a database. I just connect directly to the database file. Save having all the DSN problems your having now.

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2003
    Location
    Hyderabad
    Posts
    46

    thanks to all

    hai there


    I got the solution to my problem... at

    http://p2p.wrox.com/archive/crystal_reports/2002-08/

    thanks all of you, who responded, and viewd my problem...
    satyarao

  6. #6
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    File Connect?

    Hey Ken, how do you connect directly to the file?

    If you can't tell me that, then can someone tell me what I'm doing wrong?

    I keep get an error of 'Server has not yet been opened'. Here is my dode in the form.

    VB Code:
    1. Dim Report As New EmpRpt
    2. Screen.MousePointer = vbHourglass
    3. CRViewer1.ReportSource = Report
    4. EmpRpt.Database.Tables(1).SetLogOnInfo "ABRA.DSN", "hpersnl", "", ""
    5. EmpRpt.DiscardSavedData
    6. CRViewer1.ReportSource = EmpRpt
    7. CRViewer1.ViewReport
    8. CRViewer1.Zoom 90
    9. Screen.MousePointer = vbDefault

    Oh yea, I'm using VB 6 and Crystal Reports 8.0

    Thanks
    David Wilhelm

  7. #7
    Addicted Member
    Join Date
    Apr 1999
    Posts
    178
    When you first design the report, select database files in the Data Explorer dialog.

    Code:
    Public Sub showVendorDetail()
      
      Dim crxVendorDetail As New crVendorDetail
      
      Set crxVendorDetail = New crVendorDetail
      'Change report tables locations.
      For Each crxDB In crxVendorDetail.Database.Tables
        crxDB.Location = strDataBase
        crxDB.SetSessionInfo "", Chr(10) & strPassWord
      Next crxDB
      
      If blnRegistered Then
        crxVendorDetail.litNotRegistered.Suppress = True
      Else
        crVendorDetail.litNotRegistered.Suppress = False
      End If
      
      CRViewer1.ReportSource = crxVendorDetail
      Call setViewerDefaults
      Screen.MousePointer = vbDefault
    
    End Sub
    
    
    Public Sub setViewerDefaults()
      
      CRViewer1.EnableExportButton = True
      CRViewer1.DisplayGroupTree = False
      CRViewer1.EnablePopupMenu = False
      CRViewer1.EnableGroupTree = False
      CRViewer1.ViewReport
      CRViewer1.Top = 0
      CRViewer1.Left = 0
    
    End Sub

  8. #8
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    I don't follow

    I don't follow your code Ken.

    I have a Crystal report in my Visual basic program. I have used the wizards to connect to the database file. I have added these fields to my report.

    In my load event for this report, I guess I need some code that will keep it from giving me that error.

    The file is at H:\abrawin\data\hrpersnl.dbf

    Can you give me the code that would allow this to work for this file?

    Thanks again.
    David Wilhelm

  9. #9
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    Bump

    Anyone have any ideas?
    David Wilhelm

  10. #10
    Addicted Member
    Join Date
    Apr 1999
    Posts
    178
    Create a procedure in the form that contains CRViewer1


    Code:
    public sub showEmpRpt
    
      Dim crReport As New EmpRpt
    
      Dim crxDB  As CRAXDRT.DatabaseTable   'Database object.
    
      Screen.MousePointer = vbHourglass
    
      set crReport As New EmpRpt
    
      'Change report tables locations.
      For Each crReport In crReport .Database.Tables
        crxDB.Location = "H:\abrawin\data\hrpersnl.dbf" 
       ' crxDB.SetSessionInfo "", Chr(10) & strPassWord 'Uncomment if your db is password protected.
      Next crxDB
    
      CRViewer1.ReportSource = EmpRpt
      CRViewer1.ViewReport
      CRViewer1.Zoom 90
    
      CRViewer1.ReportSource = Report
      Screen.MousePointer = vbDefault
    On another form, put a command button with the following code in the click event.
    Code:
      Dim f As frm??  'Name of form with CRViewer1
    
      Set f = New frm??
      Load f
    
      Call f.showEmpRpt
    
      f.Show
    You said that your database was access 2000. If it is, "H:\abrawin\data\hrpersnl.dbf" should be "H:\abrawin\data\hrpersnl.mdb"

  11. #11
    New Member
    Join Date
    Sep 2003
    Posts
    10
    err... just wonder if this case is in SQL Server.
    I mean, connect different database (SQL) using a same crystal report?

    Ken Bradford wrote:
    When you first design the report, select database files in the Data Explorer dialog.
    Say, there are 3 same structure database (dbA, dbB, dbC). Which one shall I select?

  12. #12
    Addicted Member
    Join Date
    Apr 1999
    Posts
    178
    I don't use SQL Server, so I can not really help you.

    I have connected the same report to different access databases, but the tables within these databases had the same name and structure.

  13. #13
    New Member
    Join Date
    Sep 2003
    Posts
    10
    It's ok. Thanks for the reply.

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