[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 !
Re: Report vs Protected access database ???
What is the error message?
-Edit below
Are you using workgroup securtity?
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...
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.
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...
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
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...
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...
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
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...
:thumb:
Re: Report vs Protected access database ???
Thanks it works good.
But wt to do if there is a subreport. it doesnt work