Results 1 to 5 of 5

Thread: Crystal Reports and secure Access db

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374

    Unhappy

    I am using Access 2000 and CR8's Crystal Report Viewer. I have the db secured with a password. Without the password the report runs and prints fine. With the password, any attempt to access the report (including selecting Browse Fields Data from the popup menu of a field) gives me the error "File could not be opened: " (table name here) " at file location: " (table name again)

    Someone help?¿!¿

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Location
    Australia
    Posts
    69

    Try this

    Here is a doc on how to set the system and db level passwords at runtime.



    How to report off a Secure Access database with Database level security



    Problem:
    What do you do in order to report off a MS Access database with database
    level password, If you are using the OCX, VCL or using the Crystal Reports
    Print Engine?


    Solution:
    1.) Using Crystal Reports OCX

    Database level password

    Syntax:
    CrystalReport1.Password = chr(10) + "database level password"


    Database level password and System Level Password

    Syntax:
    CrystalReport1.Username = "user name"
    CrystalReport1.Password = "system level password" & chr(10) + "database
    level password"


    2.) Using the Crystal Reports VCL

    Currently the VCL does not support passing the database level password at
    runtime.
    There is no track id issued yet

    3.) Using Crystal Reports Print Engine

    Private Sub Command1_Click()
    Dim NTable As Integer
    Dim SessionInfo As PESessionInfo
    Dim Report$
    Dim tableLocation As PETableLocation
    Dim Sessionhandle As Long
    Dim UserID$, Password$


    Report$ = Text1.Text

    tableLocation.StructSize = PE_SIZEOF_TABLE_LOCATION
    tableLocation.Location = Text2.Text

    UserID$ = "Admin" + Chr$(0)
    'If sytem level and database level security exist:
    Password$ = "systmLevlPassWrd" + Chr$(10) + "DBPassWrd" + Chr$(0)
    'If only database level security exists:
    'Password$ = Chr$(10) + "DBPassWrd" + Chr$(0)
    Sessionhandle = 0

    If PEOpenEngine() = 0 Then
    MsgBox ("Unable to open Engine")
    End If

    jobnum = PEOpenPrintJob(Report$)
    If jobnum = 0 Then
    PEGetErrorCode (jobnum)
    End If

    If PEOutputToWindow(jobnum, " ", 0, 0, 500, 500, 0, 0) = 0 Then
    MsgBox "Output to Window failed"
    PEGetErrorCode (jobnum)
    End If

    If crPESetNthTableSessionInfo(jobnum, NTable, UserID$, Password$,
    Sessionhandle, True) = False Then
    RCode = PEGetErrorCode(jobnum)
    End If


    If PEStartPrintJob(jobnum, True) = 0 Then
    MsgBox "Unable to Start Print Job"
    MsgBox PEGetErrorCode(jobnum)
    End If

    End Sub


  3. #3
    Lively Member
    Join Date
    Jul 2000
    Location
    Australia
    Posts
    69

    or try this...

    Problem:
    what do you do in order to report off a ms access 7 or 8 database with
    database level security. using ole automation this document covers database
    level, system level and both database and system level security at runtime
    through the cpreauto.

    solution:
    crystal reports ole automation version 6.xx

    system level security

    public app as application
    public rep as report

    private sub command1_click()
    dim pwd as string
    set app = createobject("crystal.crpe.application")
    set rep = app.openreport("drive:\path\reportfile.rpt")
    rep.database.tables(1).setsessioninfo "username", "system level password"
    end sub

    database level security

    public app as application
    public rep as report

    private sub command1_click()
    dim pwd as string
    set app = createobject("crystal.crpe.application")
    set rep = app.openreport("drive:\path\reportfile.rpt")
    rep.database.tables(1).setsessioninfo " ", chr(10) & "database level
    password"
    end sub

    system level security and database level security

    public app as application
    public rep as report

    private sub command1_click()
    dim pwd as string
    set app = createobject("crystal.crpe.application")
    set rep = app.openreport("drive:\path\reportfile.rpt")
    rep.database.tables(1).setsessioninfo "username", "system level password" &
    chr(10) & "database level password"
    end sub


    regards


    Gerard

  4. #4
    Lively Member
    Join Date
    Jul 2000
    Location
    Australia
    Posts
    69

    or try this one....

    Just for the hell of it I added the password to the following line q been my password...I was told by Seagate that this should work for a system paasword...but it did!!!

    crxRpt.Application.LogOnServer "pdsodbc.dll", "testgg",
    "d:\db\icatdata.mdb", "Admin","q"

    Let me know how you went

    Gerard

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374

    Talking

    Hi guys, thanks for all the help. I am still stuck, though. According to seagatesoftware.com, connecting through the ODBC solves this problem. It does indeed and has created me another one! When I try to print the report I get the error that the server has not yet been opened. If I try using the LogOnServer method I get the same error on that particular line of code.

    Help??

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