Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to switch the SQL database in a Crystal Report

Status
Not open for further replies.

Gabita

Programmer
May 11, 2000
2
US
HELLO!!
I am sorry for my English!! =(
it is not good =(

I was working on one application in Vb using DB access, but it become so slow. =( I am trying to find the best way to make it faster. I converted the db in access to SQL, and I saw significant changes. However, I have a problem =( .I have some reports in crystal report which used a database in access.
I sometimes needed to change my database and put the backup. In access there was not problem because I only had to set the path of the backup database. However, I don't know how can make it work in SQL.

I took this example but it didn't work. =(

I put these in a Module:

Public MyDataSource As String
Public MyUserID As String
Public MyPassword As String
Public strConnectInformation As String


Getting Ready to Use the Report.

Dim DateParam As String

'Reset Crystal Report Selection Criteria.
CrystalReport1.SelectionFormula = ""
CrystalReport1.ParameterFields(0) = ""

'Put Date in Proper Format for Crystal Reports.
DateParam = Format(DateSelected, "yyyy,mm,dd")

'Start Crystal Reports Code.
Call ConnectToCR
CrystalReport1.ParameterFields(0) = "DateToReport; DATE(" & DateParam & ") ;TRUE"
CrystalReport1.ReportFileName = "Q:\Daily.rpt"
CrystalReport1.Destination = 1 'Send to Printer
CrystalReport1.WindowTitle = "Daily Report"
CrystalReport1.Action = 1 ' Run Report

I connect to an SQL Database.

Private Sub ConnectToCR()
MyDataSource = "Name of my DSN"
MyUserID = "USER"
MyPassword = "SQL PASSWORD"
'DataSetQualifier = "Name of Oracle Table" & Chr$(0)

strConnectInformation = "DSN = " & MyDataSource & ";"
strConnectInformation = strConnectInformation & "UID = " & MyUserID & ";"
strConnectInformation = strConnectInformation & "PWD = " & MyPassword & ";"
strConnectInformation = strConnectInformation & "DSQ = " '& DataSetQualifier
CrystalReport1.Connect = strConnectInformation
End Sub


If you know another way to make it work !!
I will appreciate it

Thank you so much and I am sorry for my English !!
I know that it is terrible!!
=(


Thank you,

Gabriela Leal
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top