|
-
Jul 26th, 2003, 06:34 AM
#1
Thread Starter
Member
please help me.... CR with DSN [RESOLVED]
Hai...
I have am working with CR8.5, Access2000 and VB6.0...
it is Client/Server project...
I designed.... all reports... based on one system DSN in one of the system... which... represents... D:\Fabric\Fabric.mdb...
my DSN name is "FabricDSN"... while installing my project in another network... how to proceed with the DSN...
while calling the reports... i want to display them by getting the data from required folder.... (here one thing is to be discussed... i am having... multiple databases.... in the server.... like Fabric03.mdb, Fabric04.mdb, Fabric02.mdb... so on)
while working with my project, at the starting i will select my own... firm... , i mean to which database i want to connect...
1. Now what my problem is;... I have to get my reports... by connecting... to the required database.... (since... all databases, tables, fields.... are identical)?
2. How to change the data source of the crystal report.... at runtime... and how to refresh...it at the same time...?
3. is there any way to change the data source of DSN at runtime...from vb?
I think it is clear....
thanks in advance...
Last edited by satyarao; Jul 31st, 2003 at 01:41 AM.
satyarao
-
Jul 26th, 2003, 08:52 AM
#2
Addicted Member
-
Jul 28th, 2003, 09:17 AM
#3
Thread Starter
Member
thank you Ken...
these articles are slightly related... to my problem... but they are not sufficient enough...
can you suggest in more descriptive...
any how thank you for response...
-
Jul 28th, 2003, 10:21 AM
#4
Addicted Member
I don't use DSN to connect to a database. I just connect directly to the database file. Save having all the DSN problems your having now.
-
Jul 31st, 2003, 01:41 AM
#5
Thread Starter
Member
thanks to all
hai there
I got the solution to my problem... at
http://p2p.wrox.com/archive/crystal_reports/2002-08/
thanks all of you, who responded, and viewd my problem...
-
Sep 11th, 2003, 10:23 AM
#6
Fanatic Member
File Connect?
Hey Ken, how do you connect directly to the file?
If you can't tell me that, then can someone tell me what I'm doing wrong?
I keep get an error of 'Server has not yet been opened'. Here is my dode in the form.
VB Code:
Dim Report As New EmpRpt
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
EmpRpt.Database.Tables(1).SetLogOnInfo "ABRA.DSN", "hpersnl", "", ""
EmpRpt.DiscardSavedData
CRViewer1.ReportSource = EmpRpt
CRViewer1.ViewReport
CRViewer1.Zoom 90
Screen.MousePointer = vbDefault
Oh yea, I'm using VB 6 and Crystal Reports 8.0
Thanks
-
Sep 11th, 2003, 10:57 AM
#7
Addicted Member
When you first design the report, select database files in the Data Explorer dialog.
Code:
Public Sub showVendorDetail()
Dim crxVendorDetail As New crVendorDetail
Set crxVendorDetail = New crVendorDetail
'Change report tables locations.
For Each crxDB In crxVendorDetail.Database.Tables
crxDB.Location = strDataBase
crxDB.SetSessionInfo "", Chr(10) & strPassWord
Next crxDB
If blnRegistered Then
crxVendorDetail.litNotRegistered.Suppress = True
Else
crVendorDetail.litNotRegistered.Suppress = False
End If
CRViewer1.ReportSource = crxVendorDetail
Call setViewerDefaults
Screen.MousePointer = vbDefault
End Sub
Public Sub setViewerDefaults()
CRViewer1.EnableExportButton = True
CRViewer1.DisplayGroupTree = False
CRViewer1.EnablePopupMenu = False
CRViewer1.EnableGroupTree = False
CRViewer1.ViewReport
CRViewer1.Top = 0
CRViewer1.Left = 0
End Sub
-
Sep 11th, 2003, 11:24 AM
#8
Fanatic Member
I don't follow
I don't follow your code Ken.
I have a Crystal report in my Visual basic program. I have used the wizards to connect to the database file. I have added these fields to my report.
In my load event for this report, I guess I need some code that will keep it from giving me that error.
The file is at H:\abrawin\data\hrpersnl.dbf
Can you give me the code that would allow this to work for this file?
Thanks again.
-
Sep 11th, 2003, 03:10 PM
#9
Fanatic Member
-
Sep 11th, 2003, 03:53 PM
#10
Addicted Member
Create a procedure in the form that contains CRViewer1
Code:
public sub showEmpRpt
Dim crReport As New EmpRpt
Dim crxDB As CRAXDRT.DatabaseTable 'Database object.
Screen.MousePointer = vbHourglass
set crReport As New EmpRpt
'Change report tables locations.
For Each crReport In crReport .Database.Tables
crxDB.Location = "H:\abrawin\data\hrpersnl.dbf"
' crxDB.SetSessionInfo "", Chr(10) & strPassWord 'Uncomment if your db is password protected.
Next crxDB
CRViewer1.ReportSource = EmpRpt
CRViewer1.ViewReport
CRViewer1.Zoom 90
CRViewer1.ReportSource = Report
Screen.MousePointer = vbDefault
On another form, put a command button with the following code in the click event.
Code:
Dim f As frm?? 'Name of form with CRViewer1
Set f = New frm??
Load f
Call f.showEmpRpt
f.Show
You said that your database was access 2000. If it is, "H:\abrawin\data\hrpersnl.dbf" should be "H:\abrawin\data\hrpersnl.mdb"
-
Sep 11th, 2003, 10:47 PM
#11
New Member
err... just wonder if this case is in SQL Server.
I mean, connect different database (SQL) using a same crystal report?
Ken Bradford wrote:
When you first design the report, select database files in the Data Explorer dialog.
Say, there are 3 same structure database (dbA, dbB, dbC). Which one shall I select?
-
Sep 12th, 2003, 07:08 AM
#12
Addicted Member
I don't use SQL Server, so I can not really help you.
I have connected the same report to different access databases, but the tables within these databases had the same name and structure.
-
Sep 14th, 2003, 10:30 PM
#13
New Member
It's ok. Thanks for the reply.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|