Results 1 to 8 of 8

Thread: connecting password protected access database in crystal reports via visual basic for

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    17

    connecting password protected access database in crystal reports via visual basic for

    hello everybody
    this problem is bothering me for last two days,i have an application in VB
    with a password secured access database, in my Visual Basic application i
    have added a form and am viewing crystal report... i made connection and
    added fields to report but when i run it logon fails.. i have simply added
    connection via wizard and have given pass word there...but when i opens the
    report via Visual basic application it fails to open..i am using microsoft access as database
    also i tried giving connection string : to my form load but still giving
    error:
    string is:
    REPORT.DATABASE.LOGONSERVEREx "p2sOLEDB.DLL","PROJ.MDB
    ;"","","","OLEDB","PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA
    SOURCE=PROJ.MDB;PERSIST
    SECURITY INFO=FALSE;JET OLEDBATABASE PASSWORD=PASSWRD"
    IT GIVES DAO ERROR CODE 0XBD7
    SOURCE = DAO WORKSPACE
    DESCRIPTION : NOT A VALID PASSWORD..
    I CHNGED CONNECTION TO ODBC AND CHANGED OLEDB ABOVE TO ODBC BUT THEN IT
    GIVES ERROR SAYING ERROR IN PROVIDER IF I RUN ONLY A CRYSTAL REPORT MADE IN
    CRYSTAL REPORTS 9 WITHOUT USING VISUAL BASIC IT RUNS WELL ONLY WHEN I RUN IT
    FROM VB IT GIVES ERROR... PLZ HELP
    AM REALLY STUCK

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: connecting password protected access database in crystal reports via visual basic

    I don't know if the connection string is case sensitive, but it's worth trying it as shown below:

    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\folder\PROJ.MDB;Jet OLEDB:Database Password=PASSWRD;"

    Note that you should include the path to the database, otherwise it may not be found.

    Also, this does not include the string: "PERSIST SECURITY INFO=FALSE;", as I do not think this is required.

  3. #3
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: connecting password protected access database in crystal reports via visual basic for

    Using CR9 with a secured MSAccess DB I do the following :

    VB Code:
    1. Dim ConnectionInfo As CRAXDDRT.ConnectionProperties
    2. Dim test as String
    3.  
    4. mRepName = App.Path & "\" & mRepName
    5. test = app.path & "\" & gDBName
    6.  
    7. Set m_Rep = m_App.OpenReport(mRepName, 1)
    8. m_Rep.RecordSelectionFormula = mstrW
    9.  
    10. Set ConnectionInfo = m_Rep.Database.Tables(1).ConnectionProperties
    11. On Error Resume Next
    12. m_Rep.Database.Tables(1).DllName = "crdb_dao.dll"
    13. ConnectionInfo.DeleteAll
    14. ConnectionInfo.Add "Database Name", test
    15. ConnectionInfo.Add "Session UserID", "User Name goes Here"
    16. ConnectionInfo.Add "Session Password", "User Password goes here"
    17. ConnectionInfo.Add "System Database Path", gstrDBLoc & "\Security.mdw" <-- Change to you security DB

    In the Decare section of the form module is the following:
    VB Code:
    1. Private m_App As New CRAXDDRT.Application
    2. Private m_Rep As New CRAXDDRT.Report
    3. Public mRepName As String
    4. Public mstrW As String
    5. Public mstrUName As String
    6. Public msRepTitle As String
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    17

    Re: connecting password protected access database in crystal reports via visual basic for

    i need further help if u can plz help me out with this line
    ConnectionInfo.Add "System Database Path", gstrDBLoc & "\Security.mdw" <-- Change to you security DB
    ????????????????? am stuck plz help me asap as am in danger...
    thanks

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: connecting password protected access database in crystal reports via visual basic for

    If you don't have an MDW file, you can probably just comment out that line.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    17

    Re: connecting password protected access database in crystal reports via visual basic for

    thanks alot i am progressing with my problem my report name is crsytal report1..... it gives error "Invalid TLV Record" with line
    Dim ConnectionInfo As CRAXDDRT.ConnectionProperties
    Dim test As String
    mRepName = App.Path & "\crystalreport1.dsr"
    test = App.Path & "\proj.mdb"
    Set m_Rep = m_App.OpenReport(mRepName, 1)..............on this line
    plz help me out its urgent

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    17

    Re: connecting password protected access database in crystal reports via visual basic for

    hello evrybody in the forum...
    First of all i would like to thank Gary Mazzone for all the help and suggestions and i am able to solve the problem by following his method...thanks a lot Gary..
    thanks to si the geek ...(the super moderator ) for all the valuable inputs and suggestions..
    thanks again..

  8. #8
    New Member
    Join Date
    Jan 2008
    Posts
    2

    Re: connecting password protected access database in crystal reports via visual basic

    hello Sir,
    I m facing same problem as like u,DAO workspace and password not valid
    my code is as
    Dim ConnectionInfo As CRAXDDRT.ConnectionProperties
    Dim test As String
    str = App.Path & "\CrystalReport2.dsr"
    test = App.Path & "\DB\Utm.mdb"
    Set App1 = New CRAXDRT.Application
    Set Report1 = Report.OpenSubreport("CrystalReport1")
    For n = 1 To Report1.Database.Tables.Count
    Set ConnectionInfo = Report1.Database.Tables(n).ConnectionProperties
    Report1.Database.Tables(n).DllName = "crdb_dao.dll"
    Report1.Database.Tables(n).SetLogOnInfo "", App.Path + "\DB\Utm.mdb", "Admin", "becool"
    Report1.Database.Tables(n).SetSessionInfo "", Chr$(10) & "becool"
    Report1.Database.Tables(n).Location = App.Path + "\DB\Utm.mdb"
    Next n
    ConnectionInfo.DeleteAll
    str1 = "PROVIDER=MSDASQL.1;USER ID=ADMIN;DATA SOURCE=MS ACCESS DATABASE;INITIAL CATALOG= " & App.Path & "\DB\UTM.MDB;"""
    ConnectionInfo.Add "Database Provider", "MSDASQL.1" '"MICROSOFT.JET.OLEDB.4.0"
    ConnectionInfo.Add "Database ConnectionString", str1 '"Provider=MSDASQL.1;User ID=Admin;Data Source=MS Access Database;Initial Catalog= " & App.Path & "\DB\Utm.mdb;"""
    ConnectionInfo.Add "Database Name", test
    ConnectionInfo.Add "Databse Password", "becool"
    ConnectionInfo.Add "Session UserID", "Admin"
    ConnectionInfo.Add "Session Password", "becool"
    ConnectionInfo.Add "System Database Path", "C:\Program Files\Microsoft Office\Office\SYSTEM.MDW"
    Set Report1 = App1.OpenReport(str, 1)
    CRViewer91.ReportSource = Report1
    CRViewer91.Refresh
    CRViewer91.Zoom (10)
    CRViewer91.ViewReport
    it gives error at viewreport
    pls help me
    bye i m stucking here...............

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