mystery001
asked on
Database Source Location and VB
hi,
CR9 dev & Visual Basic 6
I want to change the database source location of a CR9 report with VB without change the location in the report file...
Thanks
CR9 dev & Visual Basic 6
I want to change the database source location of a CR9 report with VB without change the location in the report file...
Thanks
ASKER
In fact, it doesn't help me because the document is for CR8 and CR8.5. But, i've got CR9 and it's not the same methods.
Thanks anyway. :-)
Thanks anyway. :-)
What code are you trying to use?
mlmcc
mlmcc
ASKER
This is my code
-------------------------- ---------- ---------- ---------- ---
'DECLARATION
Dim UserID As String
Dim Pwd As String
Dim v_seq As String
Dim Source As String
Dim DBsource As String
'Affectation des variables
UserID = "userID"
Pwd = "password"
Base = "baserisc"
v_seq = T_seq.Text
DBsource = "DSN=" & Base & ";;User ID=" & UserID & ";;Password=" & Pwd
'OUVERTURE DU FICHER
Set CrxRpt = CrxApp.OpenReport("C:\ccm\ prc\etats CR\cclt_ess.rpt")
'CONNEXION BASE DE DONNEE
CrxRpt.Database.Tables(1). ConnectBuf ferString = DBsource
'ENVOI DES VALEURS DES PARAMETRES
CrxRpt.ParameterFields.Get ItemByName ("v_seq"). ClearCurre ntValueAnd Range
CrxRpt.ParameterFields.Get ItemByName ("v_seq"). AddCurrent Value v_seq
CrxRpt.ParameterFields.Get ItemByName ("indice_l angue").Cl earCurrent ValueAndRa nge
CrxRpt.ParameterFields.Get ItemByName ("indice_l angue").Ad dCurrentVa lue 20000
CrxRpt.PaperSize = 155 'us LETTER
F_CRViewer.CRViewer91.Repo rtSource = CrxRpt 'Définit le fichier à ouvrir dans le contrôle
F_CRViewer.CRViewer91.View Report 'Affiche la rapport
F_CRViewer.CRViewer91.Disp layGroupTr ee = False
F_CRViewer.CRViewer91.Zoom (110)
F_CRViewer.CRViewer91.Disp layTabs = False
F_CRViewer.CRViewer91.Enab leCloseBut ton = False
F_CRViewer.CRViewer91.Enab leGroupTre e = False
F_CRViewer.Show
-------------------------- ---------- ---------- ---------- ---
With this method i can connect to my database "baserisc" ("baserisc" being the database set in cclt_ess.rpt).
The problem is that, in my case, i have 4 differents databases (baserisc, baserisd, baserish, baserise) and i want to be able to connect to the differents databases (all the databases have the same structure).
And i don't want to create 4 files with a different database for each file. So, i have to do that in VB !
Thanks to help me. :-)
--------------------------
'DECLARATION
Dim UserID As String
Dim Pwd As String
Dim v_seq As String
Dim Source As String
Dim DBsource As String
'Affectation des variables
UserID = "userID"
Pwd = "password"
Base = "baserisc"
v_seq = T_seq.Text
DBsource = "DSN=" & Base & ";;User ID=" & UserID & ";;Password=" & Pwd
'OUVERTURE DU FICHER
Set CrxRpt = CrxApp.OpenReport("C:\ccm\
'CONNEXION BASE DE DONNEE
CrxRpt.Database.Tables(1).
'ENVOI DES VALEURS DES PARAMETRES
CrxRpt.ParameterFields.Get
CrxRpt.ParameterFields.Get
CrxRpt.ParameterFields.Get
CrxRpt.ParameterFields.Get
CrxRpt.PaperSize = 155 'us LETTER
F_CRViewer.CRViewer91.Repo
F_CRViewer.CRViewer91.View
F_CRViewer.CRViewer91.Disp
F_CRViewer.CRViewer91.Zoom
F_CRViewer.CRViewer91.Disp
F_CRViewer.CRViewer91.Enab
F_CRViewer.CRViewer91.Enab
F_CRViewer.Show
--------------------------
With this method i can connect to my database "baserisc" ("baserisc" being the database set in cclt_ess.rpt).
The problem is that, in my case, i have 4 differents databases (baserisc, baserisd, baserish, baserise) and i want to be able to connect to the differents databases (all the databases have the same structure).
And i don't want to create 4 files with a different database for each file. So, i have to do that in VB !
Thanks to help me. :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://support.crystaldecisions.com/communityCS/TechnicalPapers/cr_rdc_dbconnectivity.pdf.asp
mlmcc