Results 1 to 11 of 11

Thread: [RESOLVED] Report vs Protected access database ???

  1. #1

    Thread Starter
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Resolved [RESOLVED] Report vs Protected access database ???

    Hi everybody !

    I'm trying to open a report that uses datas from a protected access database and I'm unable ?

    I checked on this forum and I found nothing that solves my problem...

    Is someone could help me ?

    I'm using VB6, Access 2003 et CR8.5

    Code:
    'Show the report
    With CRpt1
            .Password = Chr(10) & DatafilePwd
            .ReportFileName = pathName(34)
            .WindowTitle = "Estima 2007 - Bon de production"
            .PrintReport
    End With
    Thanks in advance !
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

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

    Re: Report vs Protected access database ???

    What is the error message?

    -Edit below

    Are you using workgroup securtity?
    Last edited by GaryMazzone; Aug 22nd, 2007 at 08:25 AM. Reason: More infor for Secure DB
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3

    Thread Starter
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Re: Report vs Protected access database ???

    Quote Originally Posted by GaryMazzone
    What is the error message?
    Nothing happen ???

    About workgroup, I think no...Because, before I put a password on my database, the report was displayed...
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

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

    Re: Report vs Protected access database ???

    Did you step thopught the code using breadkpoints and F8? If it didn't work we need more info then Nothing happens.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  5. #5

    Thread Starter
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Re: Report vs Protected access database ???

    Quote Originally Posted by GaryMazzone
    Did you step thopught the code using breadkpoints and F8? If it didn't work we need more info then Nothing happens.
    I tried that and vb pass over the line...
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

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

    Re: Report vs Protected access database ???

    So it never gets to the With CRpt1 line or the .Password line?

    By the way I always hated CR with security on MS databases
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  7. #7

    Thread Starter
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Re: Report vs Protected access database ???

    Quote Originally Posted by GaryMazzone
    So it never gets to the With CRpt1 line or the .Password line?

    By the way I always hated CR with security on MS databases
    Oooppsss I did a mistake, Im not very good in english ! Vb pass on the line...
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

  8. #8

    Thread Starter
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Re: Report vs Protected access database ???

    Finally the solution is:

    Report.Password = Chr(10) & "Password"

    Im sorry GaryMazzone if I take your time, I forgot to change the path of my database in my report...Grrrrrrr ! Sorry again...
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

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

    Re: [RESOLVED] Report vs Protected access database ???

    I would normally do that in the code each time. That way the user can place the database anywhere they want and not have the problem. I think I have some code that did that with CR 8.5 I'll look.

    -edit
    Code:
    Public Sub set_CR_Datatables(ByVal intNum as Integer)
      Dim i as Integer
      For i = 0 to intNum
          frmMainForm.crRep.DataFiles(i) = gstrLoc & "\" & gstrDBName
      Next i
    End Sub
    Ok some expliantion..
    intNum is a number that tells the sub how many data tables are in the report.
    gstrLoc is the Folder location of the database (stored in a Public string var)
    gstrDBName is the Name of the Database to use (stored in a Public string var)
    frmMainForm.crRep is the Crystal control (ocx) that is located on my main form (all reports use this one control)


    Called like this:
    Code:
    Dim strRepName As String
    Dim strRPName2 As String
    Dim strW As String
    Dim i as Integer
    
    strW = vbNullString
    If optPtoR.Value Then
      strRepName = "WorkerToRoom.rpt"  -- This is the Report Name to load
      strRPName2 = "Locations Assiged to Worker" & vbCrLf & "Sorted By Worker"  --This is the title for the report
      strW = "{Person.WorkerType <> 10}  -- Don't get Inactive Personnel
      i= 5 -- 5 datatables in the report
    ElseIf....
    Else
      Exit Sub
    End If
    frmMainForm.crRep.ReportTitle = strRPName2
    frmMainForm.crRep.ReportFileName = App.Path & "\" & strRepname
    mdlGeneral.set_CR_Datatables(i)
    frmMainForm.crRep.ReplaceSelectionFormula strW
    Last edited by GaryMazzone; Aug 22nd, 2007 at 09:35 AM. Reason: Added some code
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  10. #10

    Thread Starter
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Re: [RESOLVED] Report vs Protected access database ???

    Thank you very much for this lesson !

    I will put that code in my program in few days...

    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

  11. #11
    Lively Member
    Join Date
    Dec 2006
    Posts
    81

    Re: Report vs Protected access database ???

    Thanks it works good.
    But wt to do if there is a subreport. it doesnt work

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