Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 23rd, 2004, 11:12 AM
Registered User
Join Date: Jun 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default CR8 - change location of database file / tablename

I have just started using Crystal Reports 8 with VB 6...I have some Report templates already made in VB6...while making those reports tables were created as follows:

Server Type: ODBC MS Access 97 Database
Server Name: MS Access 97 Database
Database: V:\meenakshi\system1.mdb (some mapped drive from another computer)
User ID: Admin

Now say, i want to run this project on the client side...obviously in that case, the server name (here it is access so may not change, but in the case of ms sql server 2000, the server name may change), database would change....
i want all my templates to still run....how is that possible...i have written the following piece of code, but it is still not working...i have searched lots on the forums etc. but i am sure i am missing somethind very minute somewhere....pasted below is my code:
Dim crxApplication As New CRAXDRT.Application
Public Report As CRAXDRT.Report
Dim crxDatabaseTable As CRAXDRT.DatabaseTable
Dim crxParameterField As CRAXDRT.ParameterFieldDefinition
Dim crxFormulaField As CRAXDRT.FormulaFieldDefinition
Dim cTable As CRAXDRT.DatabaseTable

Dim myServerName As String
Dim myDatabaseName As String
Dim myTableName As String

Private Sub Form_Load()

' this rptReport1 report is prepared using EMPLOYEE table in the System1.mdb and i want to change it to use the CUSTOMER table in Sytem1.mdb at runtime or i want to change the location of my database file System1.mdb from V:\meenakshi to some other place

Set Report = crxApplication.OpenReport ("V:\meenakshi_Conversion\rptReport1.rpt", 1)

frmViewer.Show vbModal

For Each cTable In Report.Database.Tables

myServerName = cTable.LogOnServerName
myDatabaseName = cTable.LogOnDatabaseName
myTableName = cTable.Name
myLocation = cTable.Location

' i am just printing the servername, database name and tablename that r currently used in the rpt
Text1.Text = myServerName
Text2.Text = myDatabaseName
Text3.Text = myTableName

'now i want to change the table name to CUSTOMER .... rest everything remains same ...or may be i move my database file, that is System1.mdb somwhere else and try to ask the report to use this database location now... in that case, table name remains same but database name changes to reflect the new location
cTable.Name = "EMPLOYEE"
cTable.Location = cTable.Name
cTable.SetLogOnInfo myServerName, myDatabaseName, "admin", ""
myServerName = cTable.LogOnServerName
myDatabaseName = cTable.LogOnDatabaseName

' i am just printing the servername, database name and tablename that r now used in the rpt
myTableName = cTable.Name
Text4.Text = myServerName
Text5.Text = myDatabaseName
Text6.Text = myTableName


frmViewer.Show vbModal
End Sub

Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Location Makepeace1 Classic ASP Databases 2 May 20th, 2008 07:51 AM
Database at different location gaurav_jain2403 ADO.NET 4 May 29th, 2006 12:50 AM
change database location on CR 10 at run time blu3_x30n Pro VB 6 0 March 30th, 2006 01:25 PM
Change TextBox control location on aspx page minhpx General .NET 2 March 4th, 2005 08:29 AM
Crystal/ASP/XML Table Location change amahan Classic ASP XML 0 August 6th, 2003 02:14 PM

All times are GMT -4. The time now is 10:28 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.