Hi
While making a report in CR11 we specify the DB
But What if I wanna specify the DB during codeing..
How do i do that.. the DB is in location
thanksCode:app.path & "\DB\data.mdb"
Printable View
Hi
While making a report in CR11 we specify the DB
But What if I wanna specify the DB during codeing..
How do i do that.. the DB is in location
thanksCode:app.path & "\DB\data.mdb"
please help..
because what is happening.. when i create an installer and run the prog.. then the viewer asks for path again because the specified path during design time is not the same as the installed path.. so this can be a lot of problem...
if you are working in VB then read crystal report tutorial at my signature.
hi
could not find an example where i can specify the database in codeing
please paste an example here.. thanks
I did check that..
could not find any code which was showing a path to DB.. all are connecting to rpt..
Out you DB and the report at thevb Code:
App.Path
so like
vb Code:
With CrystalReport1 .ReportFileName = App.Path & "\ReportName.rpt" & "\db\db.mdb"
No post your whole codeQuote:
Originally Posted by khandu
not working on code
are you using VB.NET
VB 6.0
i got the above code help from another person..
please help with the DB path
No needQuote:
But What if I wanna specify the DB during codeing..
use the DB Path in the connection USE the DSN for the report.
I make report In the VB 6.0 using the DSN not the DB Path
I suggest you that if you are using the connection string in the project then use the DSN
ans make report using the DSN
Then they call automaticallly
Hi i m totally new to this
can u explain exactly what to do in the report..
this is how i do in the design
http://img296.imageshack.us/img296/2520/daoxc7.th.gif
Hi
Some help here Shakti please.. show me what codes to add on top to define "app.path & "/db/db.mdb"
thanks
Tell me what are you using in your project DSN or connectionstring
as i showed u the code on top..
I designed a rpt in CR11 directly and gave a direct connection to it and picked up fields from there.. so its always asking for that path which i gave from browse.. i think its DSN..
the pic above shows i gave a direct connection
bump.. help plz
shakti
please help out
how to mention to pick db from app.path & "\asd\db.mdb"
please help here..
I have never used CR 11 but the CRAXDRT of prior versions all have a method that lets you specify the database location of every table. Something like
I don't access to Crystal right now so cannot confirm the actual method names. Anyways, use the help file or object browser to find the object/method you need to call.Code:For Each DatabaseTable in DatabaseTables
DatabaseTable.SetLocation App.Path & "\Data\Database.mdb"
Next
the method
.setlocation is not showing in the CR 11
.SetLocation was just my guess for the method name.
What other methods are there in CR 11? You are allowed to think for yourself...
cannot find any such method for it.. :(
According to the online documentation, use the SetTableLocation method, Location property or the ConnectionProperties property of the DatabaseTable object.
I tried this.. i use DAO for connection to DB in the project
vb Code:
For Each crxDatabaseTable In crxDatabaseTables crxDatabaseTable.SetDataSource App.Path & "\database\db.mdb" Next
Gave the error
This is the syntax showing for setdatasourceCode:Run time error 424 Object required
Quote:
SetDataSource Method (Database Object)
The SetDataSource method is used to provide information about a data source to the database driver associated with this Database object at runtime. For instance, if a report has been designed using the Crystal Active Data Driver this method can be used to provide an active data source for the report, such as a DAO, ADO, or RDO Recordset or a CDO Rowset. In this case, the object passed to the second parameter of this method replaces, at runtime, the field definition file used to create the report. This method can be invoked only in formatting Idle mode. When using a secure connection such as SQL Server, some additional code is required
Syntax
Sub SetDataSource (data, [dataTag], [tableNumber])
The SetDataSource method expects an object, like a DAO.Recordset or ADO.Recordset, not the path to a database file. Are you trying to pass a DAO.Recordset to the report?
http://devlibrary.businessobjects.co.../en/devlib.htmCode:For Each crxDatabaseTable In crxDatabaseTables
crxDatabaseTable.Location App.Path & "\database\db.mdb"
Next
well, it says invalid use of property for above also..
man..
crxDatabaseTable.Location = App.Path & "\database\db.mdb"
Did you even try looking at the documentation? A little browsing and you would've found
http://devlibrary.businessobjects.co...0.html#1686406
I tried as suggested.. still the same error
on the above mentioned line..Quote:
Object variable or With block variable not set (Error 91)
*bump*
can some1 please upload a small proj here showing how to select manual location of DB for CR11 reports in VB6 during runtime..
thanks
*bump*
*bump* please help someone..
I don't understand why the link posted earlier does not help you. I don't have CR11 so cannot create a sample app. Post your modified code...
http://devlibrary.businessobjects.co...0.html#1686406
This is what I use to do CRXI with VB6
On a form that hold the ReportVeiwer do the following:
In the Declations section of the form:
Now create a sub Named DisplayReport:vb Code:
Private m_App As New CRAXDDRT.Application Private m_Rep As New CRAXDDRT.Report Public mRepName As String Public mstrW As String Public mstrUName As String Public msRepTitle As String Public mstrRef As String Public mstrC3 As String Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
vb Code:
Public Sub DisplayReport() Dim ConnectionInfo As CRAXDDRT.ConnectionProperties Dim strPNameP As String Dim test As String Set m_Rep = Nothing strPNameP = mRepName mRepName = App.Path & "\" & mRepName test = gstrDBLoc & "\" & gstrDBName Set m_Rep = m_App.OpenReport(mRepName, 1) If strPNameP = "RempRep1.rpt" Then m_Rep.RecordSelectionFormula = m_Rep.RecordSelectionFormula & mstrW ElseIf strPNameP = "RempRep1_HB.rpt" Then m_Rep.RecordSelectionFormula = m_Rep.RecordSelectionFormula & mstrW ElseIf strPNameP = "RempRep2.rpt" Then m_Rep.RecordSelectionFormula = m_Rep.RecordSelectionFormula & mstrW ElseIf strPNameP = "RempRep2_HB.rpt" Then m_Rep.RecordSelectionFormula = m_Rep.RecordSelectionFormula & mstrW Else m_Rep.RecordSelectionFormula = mstrW End If Set ConnectionInfo = m_Rep.Database.Tables(1).ConnectionProperties On Error Resume Next m_Rep.Database.Tables(1).DllName = "crdb_dao.dll" ConnectionInfo.DeleteAll ConnectionInfo.Add "Database Name", test ConnectionInfo.Add "Session UserID", "Report" ConnectionInfo.Add "Session Password", "" ConnectionInfo.Add "System Database Path", gstrDBLoc & "\Security.mdw" If strPNameP = "FSSResultsbyNuclide(Area)_New.rpt" Then m_Rep.ReportTitle = "Sample Results by Rank" ElseIf strPNameP = "FSSSamplesforAreaDetail_New.rpt" Then m_Rep.ReportTitle = "Sample Analysis Results by Area" ElseIf strPNameP = "DataFrequencyPlot.rpt" Then m_Rep.ReportTitle = "Data Frequency Plot for " & fRepGen.cboIsotopes.Text ElseIf strPNameP = "E600SurveysinArea.rpt" Then m_Rep.ReportTitle = msRepTitle ElseIf strPNameP = "DataQuantPlot.rpt" Then m_Rep.ReportTitle = "Data Quantile Plot for " & fRepGen.cboIsotopes.Text ElseIf strPNameP = "AreaComps.rpt" Then m_Rep.EnableParameterPrompting = False m_Rep.ParameterFields(1).AddCurrentValue (mstrRef) m_Rep.ParameterFields(2).AddCurrentValue (Me.mstrC3) ElseIf strPNameP = "RempRep1.rpt" Then m_Rep.EnableParameterPrompting = False m_Rep.ParameterFields(1).AddCurrentValue mstrC3 ElseIf strPNameP = "RempRep1_HB.rpt" Then m_Rep.EnableParameterPrompting = False m_Rep.ParameterFields(1).AddCurrentValue mstrC3 ElseIf strPNameP = "RempRep2.rpt" Then m_Rep.EnableParameterPrompting = False m_Rep.ParameterFields(1).AddCurrentValue mstrC3 ElseIf strPNameP = "RempRep2_HB.rpt" Then m_Rep.EnableParameterPrompting = False m_Rep.ParameterFields(1).AddCurrentValue mstrC3 End If crView.ReportSource = m_Rep Sleep 2000 crView.ViewReport 'crView.Zoom 1 If strPNameP = "AreaComps.rpt" Then m_Rep.ParameterFields.Delete (1) m_Rep.ParameterFields.Delete (2) ElseIf strPNameP = "RempRep1.rpt" Then m_Rep.ParameterFields.Delete (1) ElseIf strPNameP = "RempRep1_HB.rpt" Then m_Rep.ParameterFields.Delete (1) ElseIf strPNameP = "RempRep2.rpt" Then m_Rep.ParameterFields.Delete (1) ElseIf strPNameP = "RempRep2_HB.rpt" Then m_Rep.ParameterFields.Delete (1) End If Set m_Rep = Nothing End Sub
That is called from the print but on the form I have to generate the reports. This use a security database and uses group security. But you should get the basic idea of how to do this here.
error is mentioned on top
What Error? At the top of what?
Did you include the references for Crystal as follows:
Crystal Reports Viewer Library 11.0
Crystal Reports ActiveX Designer Design and Runtime Library 11.0
Crystal Reports Activex Designer Runtime Library 11.0
yes.. all the runtime are included
I get the error on the line
For Each crxDatabaseTable In crxDatabaseTables
Runtime 424 Object required
some1 please modify the above code so that i can mention the DB location at runtime for the reports..
Use the following code but place it after the report is opened, ie after
Set crxReport = crxApp.OpenReport(reportname)
Code:Set crxDatabaseTables = crxReport.Database.Tables
For Each crxDatabaseTable In crxDatabaseTables
crxDatabaseTable.Location = App.Path & "\database\db.mdb"
Next
excellent.. repped and FINALLY RESOLVED!!!!
will put that code after all the report call..
THANKS A LOT!!