Results 1 to 11 of 11

Thread: Error of Password in Crystal Report

  1. #1
    Hyperactive Member
    Join Date
    Nov 10
    Location
    Pakistan
    Posts
    270

    Error of Password in Crystal Report

    I make crosstab crystal report and then want to display it through vb, it display error
    Name:  4.JPG
Views: 216
Size:  13.0 KB
    I am using
    Crystal Report 9
    Visual Basic 6

  2. #2
    Frenzied Member
    Join Date
    May 06
    Location
    some place in the cloud
    Posts
    1,657

    Re: Error of Password in Crystal Report

    It would be good if you post :
    a) the code where you call the rpt
    b) the data source properties that you use in the rpt
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  3. #3
    Hyperactive Member
    Join Date
    Nov 10
    Location
    Pakistan
    Posts
    270

    Re: Error of Password in Crystal Report

    I didn't use any code to view this report.
    I created this report in crystal report 9 through crosstab wizard and want to display in vb6.
    My database has password and i give it in cr9, it is working, but in vb there is an error even though i set its password by right clicking on database fields and set database location, database expert, all is working fine but when i want to show it, it give error as i mentioned in post no.1

  4. #4
    Frenzied Member
    Join Date
    May 06
    Location
    some place in the cloud
    Posts
    1,657

    Re: Error of Password in Crystal Report

    AFAIK, If the database is password protected we must provide the user and password when we call a rpt from a vb6 application

    In a vb6 application We need to use some code to call and view any CR report
    In your case the expert you used created it for you
    Look for that code and post it
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  5. #5
    Hyperactive Member
    Join Date
    Nov 10
    Location
    Pakistan
    Posts
    270

    Re: Error of Password in Crystal Report

    Undermentioned code is on crystal report bydefault form:
    Dim Report As New CRMonExp

    Private Sub Form_Load()
    Screen.MousePointer = vbHourglass
    CRViewer91.ReportSource = Report
    CRViewer91.ViewReport
    Screen.MousePointer = vbDefault
    End Sub

    Private Sub Form_Resize()
    CRViewer91.Top = 0
    CRViewer91.Left = 0
    CRViewer91.Height = ScaleHeight
    CRViewer91.Width = ScaleWidth
    End Sub

    I m using first time crystal report bcoz there is no way to create crosstab query in datareport, so i didn't know about crystal report much but i m in trouble nd want to resolve this issue very soon. Kindly help me

  6. #6
    Frenzied Member
    Join Date
    May 06
    Location
    some place in the cloud
    Posts
    1,657

    Re: Error of Password in Crystal Report

    Crystal Reports' report designed using OLEDB (ADO) as data source

    This example demonstrates how to connect to an OLEDB (ADO) data source,
    change the data source, and change the database by using the ConnectionProperty Object,
    as well as how to change the table name by using the Location property of the DatabaseTable Object.
    CrystalReport1 is created using an ODBC data source connected to the pubs database on
    Microsoft SQL Server.
    The report is based off the authors table.

    Code:
    ' Create a new instance of the report.
    Dim Report As New CrystalReport1
    
    Private Sub Form_Load()
    
      ' Declare a ConnectionProperty object.
      Dim CPProperty As CRAXDRT.ConnectionProperty
      
      ' Declare a DatabaseTable object.
      Dim DBTable As CRAXDRT.DatabaseTable
    
      ' Get the first table in the report.
      Set DBTable = Report.Database.Tables(1)
    
      ' Get the "Data Source" property from the ConnectionProperties collection.
      Set CPProperty = DBTable.ConnectionProperties("Data Source")
    
      ' Set the new data source (server name).
      ' Note: You do not need to set this property if you are using the same data source.
      CPProperty.Value = "Server2"
    
      ' Get the "User ID" property from the ConnectionProperties collection.
      Set CPProperty = DBTable.ConnectionProperties("User ID")
    
      ' Set the user name.
      ' Note: You do not need to set this property if you are using the same user name.
      CPProperty.Value = "UserName"
    
      ' Get the "Password" property from the ConnectionProperties collection.
      Set CPProperty = DBTable.ConnectionProperties("Password")
    
      ' Set the password.
      ' Note: You must always set the password if one is required.
      CPProperty.Value = "Password"
    
      ' Get the "Initial Catalog" (database name) property from the ConnectionProperties collection.
      ' Note: You do not need to set this property if you are using the same database.
      Set CPProperty = DBTable.ConnectionProperties("Initial Catalog")
    
      ' Set the new database name.
      CPProperty.Value = "master"
    
      ' Set the new table name.
      DBTable.Location = "authors2"
    
      ' Set the report source of the viewer and view the report.
      CRViewer91.ReportSource = Report
      CRViewer91.ViewReport
      Screen.MousePointer = vbDefault
    
    End Sub
    Hope this help
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  7. #7
    Hyperactive Member
    Join Date
    Nov 10
    Location
    Pakistan
    Posts
    270

    Re: Error of Password in Crystal Report

    I want to use your code but it give following error and terminate the application

    Name:  error.JPG
Views: 177
Size:  12.0 KB

  8. #8
    Frenzied Member
    Join Date
    May 06
    Location
    some place in the cloud
    Posts
    1,657

    Re: Error of Password in Crystal Report

    This is a small project just to show one way to call a rpt from a vb6 app if the rpt is using a password protected db
    Attached Files Attached Files
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  9. #9
    Hyperactive Member
    Join Date
    Nov 10
    Location
    Pakistan
    Posts
    270

    Re: Error of Password in Crystal Report

    Thanx JG for helping me out:
    It is good example when i used .mdb file (Access 2003 format) but when i want to use it with Access 2007 format .accdb then it will give error as i mentioned in post # 7.

  10. #10
    Frenzied Member
    Join Date
    May 06
    Location
    some place in the cloud
    Posts
    1,657

    Re: Error of Password in Crystal Report

    Same example but now using Access 2007 db
    Attached Images Attached Images
    Attached Files Attached Files
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  11. #11
    Hyperactive Member
    Join Date
    Nov 10
    Location
    Pakistan
    Posts
    270

    Re: Error of Password in Crystal Report

    Thanx, let me check and confirm.......

Posting Permissions

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