Crystal Reports (Change Server In RPT)
I have a serious problem when i change the name of my SQL Server. The RPT's files open, but always ask the server name and password for logon. And always they bring the name of the old SQL Server
How can i change in definitive the RPT File for New SQL Server Name.
I appreciate for any help
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Change The Database Location In Crystal Reports Sub Reports From VB During Runtime
I have several reports that were designed in Crystal Reports that have the DB location changed during runtime. When I move my database, or choose another copy of the DB that has a lot of records in it, my reports don't fire. I need to be able to Verify the database during runtime. I'm usiung VB6.0 and CrystalReports8.5 I've tried using Crystal's "Verify On Every Print" function, but I haven't had any luck. Here is the code I am using.
MyLocation = "C:mydatabase.mdb"
CRPE321.ReportFileName = "c:aptcom
eports eninfo.rpt"
CRPE321.DataFiles(0) = MyLocation
CRPE321.ParameterFields(0) = "ThisKey;" & Who.Text & ";true"
CRPE321.PrintReport
Also, does anyone know if changing the DataFiles location during runtime also effects the subreports. I don't think it does, but any input would be appreciative.
Change The Database Location In Crystal Reports Sub Reports From VB During Runtime
I've created a Report Viewer that displays Crystal Reports 8.5 reports. I have the DB location in Crystal Reports changed during runtime, but I can't get the location to change in the subreports at runtime as well. Also, by using my method of calling the reports, I can't get VB to pass any parameters to the Main report. Below is the code that I am using. I'm using VB 6.0 and CR 8.5
Dim MyNewKey
MyNewKey = Who.Text
' On Error GoTo KeepGoing
MyLocation = GetStringValue("HKEY_LOCAL_MACHINESoftwareAptCom", "AptCom DB Path")
strReportFile = "c:aptcom
eports eninfo.rpt"
Set CRReport = New CRAXDRT.Report
Set CrxApp = CreateObject("crystalruntime.application")
Set CRReport = CrxApp.OpenReport(strReportFile)
' Set CRReport.ParameterFields(0) = "ThisKey;" & MyNewKey & ";true"
' KeepGoing:
For Each dbTable In CRReport.Database.Tables
dbTable.SetLogOnInfo "", MyLocation, "", ""
dbTable.Location = MyLocation
dbTable.SetDataSource MyLocation
Next dbTable
CRReport.Database.Verify
CRReport.SQLQueryString = strSQL
frmReportViewer.Show
frmReportViewer.CRViewer1.ReportSource = CRReport
frmReportViewer.CRViewer1.ViewReport
Set CRReport = Nothing
Set CrxApp = Nothing
Set CRReport = Nothing
>>>>
I've tried using this method:
MyLocation = "C:mydatabase.mdb"
CRPE321.ReportFileName = "c:aptcom
eports eninfo.rpt"
CRPE321.DataFiles(0) = MyLocation
CRPE321.ParameterFields(0) = "ThisKey;" & Who.Text & ";true"
CRPE321.PrintReport
But, I can't get Crystal Reports to verify the database during runtime. The first way verifies the DB, but won't change the DB location of the subreports or pass parameters to the reports.
Any help would be appriciative.
How To Change DSN For Crystal Reports
I have generated various reports using Crystal Reports 7.0. Now, without changing the design and the fields for the reports, I want to change the DSN, so that I can access another similar database.
Can I change the DSN without re-designing the crystal reports. Any suggestions are welcome.
Crystal Reports Datasource Change
Hi folks,
Thanks to MKoslof yesterday, I managed to set up my application to view all reports through one CRViewer (Thanx again),
Today, I am trying to change the datasource of a report so that I do not need a different report for each query that displays the same fields.
The code I am using is:
Code:
Dim application As New CRAXDRT.application
Dim selectedreport As String
Dim CurrentRpt As CRAXDRT.Report
selectedreport = App.Path & "
eport1.rpt"
Set CurrentRpt = application.OpenReport(selectedreport)
'ShowReport
CurrentRpt.Database.SetDataSource DE_Test.rsByName
With Frm_ReportViewer
.Show
'code below courtesy of MKoslof
Screen.MousePointer = vbHourglass
.CRV_Report.ReportSource = CurrentRpt
.CRV_Report.ViewReport
.CRV_Report.Zoom 100
Screen.MousePointer = vbDefault
End With
The problem is that the data in the report displays the original and not the changed recordset. Can anyone help?
Change Group In Crystal Reports
Can someone help me change the grouping in my crystal report through VB code? I want the user to choose either Group by Name or Group by Date from the VB interface and the report is printed with the selected grouping...
I found this on the forum but it doesn't work for me. It doesn't get into the For loop because CRReport.RecordSortFields.Count is returning 0:
Code:
Private Sub Change_Group(NewSortFieldName As String)
Dim SortField As CRAXDRT.SortField
Dim NewSortfld As CRAXDRT.SortField
Dim crxApp As CRAXDRT.Application
Set crxApp = New CRAXDRT.Application
Set crxApp = New CRAXDRT.Application
Dim CRReport As CRAXDRT.Report
Set CRReport = crxApp.OpenReport(App.Path & Report_Name, 1)
For Each SortField In CRReport.RecordSortFields
If NewSortFieldName = SortField.Field.Name Then
Set NewSortfld = SortField
Set SortField = CRReport.RecordSortFields(1)
SortField.Field = NewSortfld.Field
CRReport.Areas.Item("GH").GroupConditionField = SortField.Field
If SortOrder = "Ascending" Then
'SortField.SortDirection = crAscendingOrder
CRReport.Areas.Item("GH").SortDirection = crAscendingOrder
Else
'SortField.SortDirection = crDescendingOrder
CRReport.Areas.Item("GH").SortDirection = crDescendingOrder
End If
Exit For
End If
Next
End Sub
VB 6/Crystal Reports 9 - Change DB At Runtime?
I'm using the Crystal Reports 9 ActiveX Designer Runtime Library to view and print existing Crystal Reports in a VB6 application connecting to a SQL2000 database. Is there any way to change the database used by the report at runtime? I need to be able to switch between reporting against identical databases on different servers.
I've been trying to use the LogOnServer & LogOnServerEx methods of the report's CRAXDRT.Database object, but I've been getting an OLE DB error with description: "Data source name not found and no default driver specified". I'm not even sure that this is the correct approach, as the Crystal developer help states, "This method can be invoked only in formatting Idle mode", and I can't seem to find out what exactly "formatting Idle" mode is. I'm inclined to think that these methods aren't really what I want, but the Crystal documentation is less than wonderful, and I can't find anything helpful on their website.
Thanks in advance!
Edited by - kconklin on 11/21/2003 11:43:40 AM
Change The Ttx File In Crystal Reports From VB
How can I through VB point a ttx file to a newly created crystal report and then
set a ado datasource to that report. All of this must be done from VB.
I am using SQL 2000, Crystal reports 8.5 and VB6
Crystal Reports - Database Change
How can I change the database of a report in run-time from VB. I use ODBC to access a SQL Server database. I change the database source of ODBC but the report query the initial database.
Thanks.
Crystal Reports 8 & SQL Server
Hi guys (and girls of course),
we got a little problem here, now i tell you:
Situation:
I've made reports with Seagate Crystal Report 8, this report are linked to a SQL server db, i use this report in my VB6 app, all work fine.
BUT
i MUST made apps that work fine everywhere even if the SERVER change, i've followed the Seagate's instruction about .connect method, and .logonserver method but they don't work!
i've got a lot of errors like Database .dll error, or can't open the db etc. etc.
Please Help Me i'm so confused!
Crystal Reports + VB + SQL Server
I searched and found this http://www.vbcity.com/forums/topic.asp?tid=4039&highlight=crpReport but it doesn't work for me.
I built my reports in Crystal Reports then imported them to VB into the RDC. I used to use an Access database and to set the database location for the RDC I used this code:
Code:For I = 1 To Report.Database.Tables.Count
Report.Database.Tables.Item(I).Location = SourceFile 'SourceFile holds the location of the Access database
Next I
I have now changed over to SQL Server 2000 but nothing I do will allow me to link my reports to the SQL Server database!
I tried adding the Crystal Reports control to the form and this code:
WEBSERVER is the name of the server with SQL running on it
AMSTRACKINGSQL is the name of the database in SQL Server.
Code:crpReport.Connect = "DSN =WEBSERVER;UID = sa;PWD =ams;DSQ =AMSTRACKINGSQL"
crpReport.ReportFileName = App.Path & "
eports
ew_nurseprofit.rpt"
crpReport.Action = 1
When running that code it stops at "crpReport.Action=1" with the error message "Unable to open database"
I also tried to use report.Database.LogOnServer but I couldn't get that to work either!
I also tried making a DSN called AMSTRACKING and used:
Code:crpReport.Connect = "DSN =AMSTRACKING;UID = sa;PWD =ams"
crpReport.ReportFileName = App.Path & "
eports
ew_nurseprofit.rpt"
crpReport.Action = 1
But nothing!
please help! thanks
Crystal Reports & SQL Server
I'm using Crystal Reports 8 to print data from SQL Server and I need to change the SQL Server name from VB. How can I do this? Thanks.
VB6 With Crystal Reports 6.0 And MS SQL SERVER
CAn someone help me on the connection part of the database to crystal reports? i'm using ADO , got confused on the wizard of crystal reports. Can anyone give me some steps to start on?
like for example the server name is proj3
and the database is in s7606366
database name is adexam
with a passwd ...
wat shld i do ?
my email address is zijing@singnet.com.sg
Can You Change Login Details On Crystal Reports?!!!
I am using VB6, MS SQL SERVER 7 and Crystal Reports 5
Here's my problem:
All the reports designed in CR5 use a username that is not password protected. I need to lock down this username with a password, but no reports generate once the password is put on. I have tried using the 'connect' property of the crystal report control but that doesn't seem to work either!
Does anyone have any thoughts on this?
How To Change Mail Labels In Crystal Reports
Hai,
I create a Mail Label report (3 x 4 landscape) in crystal reports, after create report how to change its direction like down then across and how change label size and distance between lables. ple. send me the solution it is very useful to me. thanks in advance regards CHANDU
Crystal Reports - Change Currency Format
I've designed some reports that will be used in different areas (Ireland & UK), so my VB app needs to be able to change the report currency format at run time.
I assume you're able to do this using the Crystal Automation Engine, does anyone know of any source for this - must be something that people do quite regularly!
Any links/code appreciated
Thanks
Conecting Crystal Reports To Server
I'm using Crystal 8 with Visual Basic 6... can someone tell me what i need to do to connect my reports to server... I'm trying to use LogOnServer but It's not working. I think I'm doing something wrong in the command line... please, the correct sintax can help me a lot...
Thaks,
Wanialdo Lima
Crystal Reports Server Not Yet Logged On.
I checked many posts but was unable to find an answer.
I have Crystal Reports 8.5 and am using VB6.
I create the Crystal Report in VB6. I am connecting to a SQL database using the wizard that starts up when I make the new report.
I have two items in my VB6 program. CrystalReport1 and Form1(CRViewer)
The report works fine on my machine, on someone elses machine, but doesn't work on a 3rd person's machine.
I keep getting the error Server not yet logged on.
I am using the Server login name and password when I selected the database when I created the report.
Here is the code in my CRViewer form.
Dim Report As New CrystalReport1
Private Sub Form_Load()
Screen.MousePointer = vbHourglass
Report.DiscardSavedData
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
End Sub
Anyone have any ideas why this would work on one computer, but not the next?
Thanks in advance.
Crystal Reports--Cannot Find SQL Server.
i have a crystal report it connect to sql server and use a store procedure...
at runtime when i try to view the report i get a error..
err number20599 ... Cannot find SQL server.
i tried out all this
CrystalReport1.ReportFileName = App.Path & "ord.rpt"
CrystalReport1.Connect = "DSN = star;UID = sa;PWD = ;DSQ = custcare"
CrystalReport1.ReportFileName = "T:StarbccSTARBCCord.rpt"
CrystalReport1.StoredProcParam(0) = Txt_OrdID
CrystalReport1.Action = 1
still i get the error
when i open from crystal report and view after giving the dsn it works....
any idea how it can ge solved
thanks for suggestion
Crystal Reports With ADO And Automation Server
Please help, I have an SQL database and I want to use VB to log on, return a recordset that will be previewed in Crystal Reports.
However, I get an error message all the time "login failed for user "sa"" and then another one "cannot open SQL server".
What is wrong??? (The password is correct, I am able to get a good recordset in return). Do I lose the connection somewhere??
Here is my code:
Public Conn As New ADODB.Connection
Public rs As New ADODB.Recordset
Public err As ADODB.Error
Public str As String
---------------------------------------
Public Function crystal()
Dim application As CRPEAuto.application
Dim Report As CRPEAuto.Report
str = "select * from performance where accno=400002"
'login
Conn.Open "Driver=SQL Server;Server=UNREAL;Database=performance;User ID=sa;Password=laser"
Set rs = Conn.Execute(str)
'test for recordset (works fine)
rs.MoveFirst
MsgBox rs(1).Value
'test for connection (works fine)
If Conn.State = adStateOpen Then
MsgBox "OK"
Else
MsgBox "Not OK"
End If
'Have not even tried the SetPrivateData yet since the Preview doesn't work...
'report.Database.Tables("ado").SetPrivateData 3, rs
Set application = CreateObject("Crystal.CRPE.Application")
Set Report = application.OpenReport("H:vbkulperf2perf2port.rpt")
'This is where it fails
Report.Preview
MsgBox "Here is the report"
Set Report = Nothing
Set application = Nothing
rs.Close
Conn.Close
End Function
---------------------------------------------------
If there is anybody out there that could help I would be very happy!!!
Crystal Reports Won't Accept Change To Default Printer
(VB6, Crystal 9)
I've added all the printers on the computer to a combobox, so the user can select a printer to print from.
I'm using a method i found on this forum, to change the default printer - it stores the default printer, sets the newly selected printer as the default, then re-instates the old default printer. ( I could paste this code, but its a bit lengthy - its the class thats a modification of MSDN's article Q167735).
So i have a custom print dialog, and under the print button i have (where setprinter is the lengthy class):
Dim SetPrinter As New clsSetDefaultPrinter
Dim DeviceName As String
Dim smsg As String
DeviceName = cboPrinter.Text
If SetPrinter.SetPrinterAsDefault(DeviceName) Then
smsg = DeviceName & " -set"
Else
smsg = DeviceName & " -not set "
End If
MsgBox smsg, vbDefaultButton1, ""
MsgBox Printer.DeviceName & vbCrLf & Printer.DriverName & vbCrLf & _
Printer.Port, vbDefaultButton1, ""
MyReport.PrintOut False, 1, False
'destroy instance of printer class to restore printer to default
Set SetPrinter = Nothing
MsgBox Printer.DeviceName & vbCrLf & Printer.DriverName & vbCrLf & _
Printer.Port, vbDefaultButton1, ""
End Sub
See the messageboxes - they show that the default printer is indeed being changed, then restored. Yet the report is still being printed from the "default" printer - that is, its prints like the change never took place, from the original printer, not the newly selected printer.
Now whats most frustrating about this is if i run the above code in a seperate .exe, (a simple combo box which lists printers, and does the above swapping of printers), leave it open after i've changed it to the printer i want, then open the app with the above code in it, it WILL print to the printer that i want to change it to.
I've tried adding the MyReport.PrintOut :
MyReport.SelectPrinter Printer.DriverName, Printer.DeviceName, Printer.Port
But this crashes the app and shuts down vb.
Can anyone help me, i'm getting a bald patch where i'm scratching my head so much.
List Of Printers To Change Printer In Crystal Reports
I need to have a drop down list of all available printers on the computer so the user can change the printer before trying to print a crystal report. I've seen MKosolf's post on how to do it, parsing the chosen printer from a list and getting the driver name and port from that, but my question is how do I get what the driver name and port are into the list in the first place? I populate a list with:
Code:
Dim x As Printer
For Each x In Printers
listPrinters.AddItem x.DeviceName & ", " & x.Port & ", " & x.DriverName
Next
Is this correct?
Crystal Reports - Change The Database Connection *RESOLVED*
Me thinks a not so simple question!
Hi,
In VB (.net) you can view your database connection, if you have connected using the wizard in the:
#Region " Windows Form Designer generated code "
and it looks a little something like this:
VB Code:
Me.OleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=ITsMe;Data Source=C:codewh" & _ "ateverMyDatabase.mdb;Mode=Share Deny None;Extended Properties="""";Jet " & _ "OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password=" & _ """"";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Pa" & _ "rtial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Pas" & _ "sword="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False" & _ ";Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica " & _ "Repair=False;Jet OLEDB:SFP=False"
This is very nice because I can easily change the Data Source= bit to make it equal whatever database I happen to be using, wherever it is.
Now when it comes to crystal reports, (my reports I have created using Crystal Report Wizard thingy, which I like) I setup where my database is to connect to in the wizard. This would be fine but my database location could change to anything at run time depending on what database the user selects and so I want to be able to change the database source programatically like I am with the database connection thing show above.
The problem is I can't!
I can't find anything like the Me.OleDbConnection1.ConnectionString =...... bit anywhere for the Crystal Report connection and I can't see how else to do it. Any Ideas?
If I connect my Crystal Reports to datasets (so in effect there is no direct databse connection), I get problems using multiple datasets, and a window asking for database username, passwords etc appears when i try to display my report. I really don't want to do it this way.
In the search for my answer I have worked through most threads on this forum and the Crystal Decision Support forums and found nothing of help and so am posting here cos the Crystal Decision Support forums threads hardly ever get replies and you Guys nearly always come up with the goods
Cheers
URGENT Change Dbpath Of Crystal Reports At Runtime
hi,
i was using crystalreports 4.6 with vb6.0 with msasccess as database. Then i protected my database with a password, and i changed the database path for crystal reports at runtime by using
crep.datafiles(0) = "dbpath.mdb"
and
crep.password = "password".
it worked successfully.
Now i upgrade my crystal reports to version 8.0. the same code now not working. It won't allow me to change the db path. It is giving an error "Incorrect session parameters". if database password removed. it is working.
How can i change db path, when it is protected. Help me please
any help can be appriciated.
sanki
Crystal - Change SQL Server
Hi
I finished doing my reports on SQL server 2000 (name S1)
Then, I have to export my database to another SQL server 2000 (name S2).
How could I change log on server on my reports? Once I succeed (I do not know how) but reports didn't work.
I am using Crystal Reports 4.6
Please help
LogOn Server - Crystal Reports Problem
I'm using VB procedure to run my CrystalReports file and it looks like
Dim CRApp As Object
Set CRApp=CreateObject("Crystal.CRPE.Application")
CRapp.LogOnServer "pdsodbc.dll",<odbc_name>,<database_name>,"sa",<sa_pwd>
Now, I have changed ODBC data source to use trusted (Windows 2000) authentication and I do not know how to reconfigure parameters in last line of code writen above. I think that problem is with passing logon parameters (user_name, and password)???
Crystal Reports , Ado , SQL Server , Getting Results At Runtime
Hello !
this crystal reports is not well documented.
I am using SQL Server 2000.
I would like to use ADO in order to get results at runtime in order to create dynamically a report.
Also i have nowhere a saved report , i want to connect dynamically and create the report dynamically from a SQL Query.
VB Code:
Set Report = crApp.NewReportReport.PaperOrientation = crPortrait ' Set the paper orientation Dim cn As New ADODB.Connection database_open_connection cn 'opens an ado connection Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset ' set rs rs.CursorLocation = adUseClient SQLQuery = "Select * from media" Set rs = SQLQuery , cn, adOpenKeyset, adLockReadOnly ' Open the recordset CRViewer1.ReportSource = Report
Please help
Crystal Reports Error: Server Has Not Yet Been Opened
I'm using a Crystal Reports Viewer Control, to show a report in a VB form. If I install the program in a PC that doesn't have VB nor Crystal Reports installed, when I try to show the report, I get the error 'Server has not yet been opened'.
Could anybody help me with this?
Thanks a lot
How To Connect Oracle Server (Crystal Reports 8) With VB 6
Hello everyone, I need your help.
I need to make a report in a Vb's project using oracle server of Crystal Reports but I don't know how to establish the cennection into VB, do you know how is the connection string that I have to introduce in the code?????
I appreciate your help.....thanks a lot
Crystal Reports And Terminal Server 2000
I have users who connect to Terminal Server 2000 to use my application, but I am running into a problem where they receive an Error message Server has not yet been opened. The application works great on the workstations and also we had NT Terminal Server and no problem there either.
here is the code
Dim Cr as CRAXDRT.Report
Dim CRV as New CRAXDRT.Application
Public Const Name as string = "p2sodbc.dll"
dim RS as string
RS = "Server"
CRV.LogOnServer Trim(Name), Trim(RS), Trim("DATABASENAME"),Trim("UserName"),Trim(DataPassword)
Set Cr = Nothing
Set Cr = CRV.OpenReport(Path)
CRViewer.ReportSource = Cr
CRViewer.ViewReport
Is there something with Terminal Server 2000 that I am missing?
ODBC Connectivity With SQL Server & Using Crystal Reports
Ok. Thank you. But after looking at what I'm trying to do, I think it's a little more complicated. I am trying to make an application toolbox. I want users to be able to click on a button from my app and that buttin will launch the Crystal 7 Report Designer. The servers we connect to are SQL Server Databases using ODBC connections. They connect to Terminal Servers to get to the databases. I have figured out how to get my app to launch the Crystal Report I want, but I don't know how to get it to pull the ODBC, open an ODBC, or somehow connect to the database I am trying to run the report against. Once again, it is a SQL server 7.0 database I am trying to connect to. There are over 100 databases we use, and all have different ODBC drivers setup (all SQL Server, but different names obviously) so it would be good if somehow either 1) the app could determine the user's ODBC, or 2) the user could be prompted for the ODBC.
I hope that makes sense as far as what I need.
Please HELP!!!
How To Display Data In SQL Server Using Crystal Reports Ver 4.6
Hi!
I have client-SQL server application. The client gets data from SQL Server. . I have a VB6 and Crystal Reports(CR) 4.6 . I use ADO codes and ADODC control to store data. But the CR 4.6 doesn't accept ADODC Data Control. I heard of using Crystal object. But i don't how to use it. Do you have sample program like that. Please help, I need this urgently.
Thanks
CecileR
Problem With Page Break On Data Change In Crystal Reports 8
Hi all,
I've got a problem with Crystal Reports 8 (not so much a problem, more can't figure out how to do it).
I have a report linked to a Stored Procedure in SQL Server, which returns data ordered by a particular field. This works fine and prints the report in the order shown below
HEADER
XXX
XXX
YYY
YYY
etc.
What I have been asked to do now is make it so that the when the data changes in the "Sort Order" field that we can force a page break so that each group is on a serparate page like below.
HEADER
XXX
XXX
Page Break Here
HEADER
YYY
YYY
etc.
Can someone please advise on how this can be done, as I'm relatively new to Crystal Reports, or point me somewhere that I can find an example.
Thanks in advance,
Mark
**RESOLVED**Dynamically Change TextColor Of Formula In Crystal Reports
I have a formula which resides in a subreport. The results of this formula are either "Pass" or "Fail". I would like the textcolor for the result to be displayed in green for "Pass" and red for "Fail".
Anyone ever done something like this before. Not sure if I should be attempting to change the color in the Initialize event procedure of my main report or handling directly in the formula itself.
Dynamically Change Connectionstring And Database During Runtime /Crystal Reports
hi,
I have to write a prog in which i can decide during runtime which kind of database(MSSQL 7 or Access) my prog is
using. I also have to design my Reports with ADO-Connectivity(no ODBC). The connection String
the database saved in the registry.
So i wrote this piece of code:
set m_rpt = m_appTheApp.OpenReport(m_ReportFileName)
for iTable = 1 to m_rpt.Database.Tables.Count
m_rpt.Database.Tables(iTable).SetLogOnInfo ConnectionString,NameAndLocationOfDatabase , LogInName,Password
m_rpt.Database.Tables(iTable).Location = LocationOfDatabase
If Not m_rpt.Database.Tables(iTable).TestConnectivity = true then
MsgBox "Es ist ein Fehler aufgetreten"
End If
next iTable
'm_rpt.database.LogOnServer "pdsmon.dll", ConnectionString,LocationAndNameOfDatabase, LogInName, Password
m_vntRptPk.AddReport m_rpt
CRVwr.ReportSource = m_vntRptPk
CRVwr.ViewReport
If I do so my prog produces at the line where I call TestConnectivity i've got a Messagebox, titled "Database Error",
with no Messagetext within it. Further after calling CRVwr.ViewReport i've got the same messagebox and a new Messagebox
titled "Crystal Smart Viewer" and the Messagetext "Server has not connect til yet" (hope i translate it correctly).
If I add the line m_rpt.database.LogOnServer ... i've got the also the "Server has not ..." text as above after the LogOnServer-Line
Do anyone of you knows what i've done wrong?
Every help would be highly welcome.
Akademos
Make Installation Package For App With SQL Server / Crystal Reports
We make our apps in VB6, with SQL Server as the DB and Crystal Reports for presentation. We usually go personally to client sites to "install" our software, beginning with SQL Server and Crystal Reports and finally our apps.
I understand and appreciate that because SQL Server and CR need separate licences, they cannot be bundled into the app's setup CD.
I also know that there is a skeleton list of CR runtime files which can be distributed with the app and the reports will display without having to install the whole CR.
I know that there is something called MSDE / MySQL which can be distributed free with apps.
I read up on MSDE and it is not the same as SQL Server and will entail a lot of rework so is out of the question for me.
Is there any way I can include SQL Server and CR in my install?
GoodGuy
Experience is a bad teacher for its exams precede its lessons.
Preview Image From SQL Server 2000 Into Crystal Reports 8.5
Hi All,
I am using Crystal Reports 8.5 with VB 6 and SQL Server 2000.
I need to change the header image of report at runtime.
I have the image stored in SQL Server database as well as in the Hard Disk.
But i am not able to show it in the crystal reports viewer.
Can anyone help on this.
thanks in advance
Sam Alex
How To Call Sql Server Stored Procedure In Crystal Reports
Please given the Method for calling stored procedure in Crystal Reports.
I'm simply using sql server stored procedure,
through Crystal reports we pass the parameter of that st. procedure.
Thankx if you r trying.
Edited by - unique_jai on 8/20/2004 6:50:42 AM
How To Connect SQL Server 2000, Crystal Reports 8.5 And Visual Basic 6
Hi guys,
I have been using this forum for a while but only joined yesterday to post this information. Like most people I was having great difficulty in getting SQL Server 2000, Crystal Reports 8.5 and Visual Basic 6 to work together to produce reports for the end user. My main problem was the error 'SQL Server has not yet been opened'. This was due to my report having subreports within it, which nobody anywhere has properly explained.
As this took a good bit of searching and also my own coding to resolve this I thought I would post the end result on here for anyone else who was having the same difficulties.
2 Ways to do this are... Passing a SQL Query to a report or by Passing parameters from a users input.
First of all make sure that the Component Crystal Reports Viewer Control has been added to your project. Next make sure the 2 References - Crystal Reports Viewer Control and Crystal Reports 8.5 ActiveX Designer Run-Time Library have been added.
Now for the code...
Add the following to the general declarations area:
Code:
'****************************************************************************************
' General Declarations for working with Crystal Reports
'****************************************************************************************
Dim crxApp As New CRAXDRT.Application
Dim crxRpt As CRAXDRT.Report
Dim crxTables As CRAXDRT.DatabaseTables
Dim crxTable As CRAXDRT.DatabaseTable
Dim crxSubreportObject As CRAXDRT.SubreportObject
Dim crxSubReport As CRAXDRT.Report
Dim crxSections As CRAXDRT.Sections
Dim crxSection As CRAXDRT.Section
Dim crParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim crParamDef As CRAXDRT.ParameterFieldDefinition
Next place the following code behind the command button, REMOVING the code Way 1 or Way 2 depending on your application.
Code:
Private Sub cmdSubmit_Click()
'****************************************************************************************
' Variables declarations for the Database Connection
'****************************************************************************************
Dim strServerOrDSNName As String
Dim strDBNameOrPath As String
Dim strUserID As String
Dim strPassword As String
strServerOrDSNName = "servername" 'replace servername with your SQL connection server
strDBNameOrPath = "databasename" 'replace databasename with your SQL connection databasename
strUserID = "userid" 'replace userid with your SQL connection userid
strPassword = "password" 'replace password with your SQL connection password
'Open the report
Set crxApp = New CRAXDRT.Application
Set crxRpt = crxApp.OpenReport("C: est.rpt")
'Set the connection for the report.
'SetLogOnInfo is a deprecated method in CR 9, but still works.
'The suggested method for CR9 is to use the ConnectionProperty object.
crxRpt.Database.Tables(1).SetLogOnInfo strServerOrDSNName, strDBNameOrPath, strUserID, strPassword
'This removes the schema from the Database Table's Location property.
Set crxTables = crxRpt.Database.Tables
For Each crxTable In crxTables
With crxTable
.Location = .Name
End With
Next
Way 1 - Passing a SQL Query string
'***************************************Start of Way 1*************************************
'The select query to reutrn the data required
crxRpt.SQLQueryString = "SELECT whatever FROM table WHERE blah blah" 'Input your SELECT query here
'****************************************End of Way 1*************************************
Way 2 - Passing Parameters from a users input
'***************************************Start of Way 2*************************************
' Disable Parameter Prompting for the end user
crxRpt.EnableParameterPrompting = False
' Gather the list of available parameters from the report
Set crParamDefs = crxRpt.ParameterFields
' Loop through all parameters in the report by name, filling in the appropriate parameter with the right value
For Each crParamDef In crParamDefs
Select Case crParamDef.ParameterFieldName
Case "JobNumber"
crParamDef.SetCurrentValue txtJobNumber.Text
Case "POStatus"
crParamDef.SetCurrentValue POStatus
Case "PODetail"
crParamDef.SetCurrentValue PODetail
Case "WOStart"
crParamDef.SetCurrentValue txtWOStart.Text
Case "WOEnd"
crParamDef.SetCurrentValue txtWOEnd.Text
End Select
Next
'Loop through the Report's Sections to find any subreports, and change them as well
Set crxSections = crxRpt.Sections
For i = 1 To crxSections.Count
Set crxSection = crxSections(i)
For j = 1 To crxSection.ReportObjects.Count
If crxSection.ReportObjects(j).Kind = crSubreportObject Then
Set crxSubreportObject = crxSection.ReportObjects(j)
'Open the subreport, and treat like any other report
Set crxSubReport = crxSubreportObject.OpenSubreport
Set crxTables = crxSubReport.Database.Tables
For Each crxTable In crxTables
With crxTable
.SetLogOnInfo strServerOrDSNName, strDBNameOrPath, strUserID, strPassword
.Location = .Name
End With
Next
End If
Next j
Next i
'****************************************End of Way 2*************************************
'View the report
CRViewer1.ReportSource = crxRpt
CRViewer1.ViewReport
'Set the Zoom on the report
CRViewer1.Zoom (90)
End Sub
Way 2 involves passing parameters to your report, this means your reports MUST use these parameters within the report.
Hope this helps out!!!
HOW TO CONNECT CRYSTAL REPORTS TO SQL SERVER DATABASE, USING VISUAL BASIC APPLICATION
What I want is that, the Connection object which the VB application generates, should be supplied as the Report Source for the Crystal Reports.
This connection holds the details like
Server Name
Database Name
User Name
Password
So is there any thing which applies this connection to the activated crystal report file (*.rpt file) so that it automatically receives the data.
Let me bring the subject at some understandable platform by highlighting the given details.
1) To generate a Crystal report, you are bound to supply the data source. So you need specify the server, database, userid & password.
2) I suppose this all information gets stored in the form of *.rpt filename along with data & the design.
3) Let suppose that the following are the details which I supply while creating a crystal report file.
SERVER NAME: XYZ
DATABASE : DB1
USERNAME :user1
PASSWORD : admin
As I mentioned it previously, this data will get stored in rpt file (prior to my assumption)
4) Now suppose I wrap this file by some VB application which gets the user logged on with different details.
SERVER NAME: XYZ
DATABASE : DB2
USERNAME :user1
PASSWORD : admin
NOW my question is that whether the above application-user can access the data. That means whether the application connection details overrides the design details of rpt file.
I hope that I could make you all understand the problem without which nothing will get sparked.
If you have the slightest hope to accomplish the above fact , please let me know.
Crystal Reports 8.5 And Visual Basic 6--Err Message&" Server Has Not Yet Been Opened&"
I have been trying to get a pre-developed crystal report to display in a VB6 app at runtime. I can get the report to display with saved data, but when ever I use the .DiscardSavedData method and try to refresh the data I get an error message. The message is this "Server has not been opened". This is my first encounter with this version of Crystal 8.5, so I am sure that I am not using a certain method that is needed. Another question I had is do I even need to open an ADO recordset to populate the report?
Also, one other thing to point out is that my report is using to different tables from with in the same database.
=======================================================
'Declare GS Connection
Public cnGS As New ADODB.Connection
'Declare Connection String Variable
Public sGSConString As String
'Declare ADO record set
Public rsSelect As New ADODB.Recordset
Public rsExec As New ADODB.Recordset
'Declare SQL query string
Public sSQLSelect As String
Public sSQLExec As String
' Declare the application object
Public crxApplication As New CRAXDRT.Application
' Declare report object
Public crxReport As CRAXDRT.Report
Private Sub cmdViewReport_Click()
Call LoadReport
End Sub
Private Sub Form_Load()
Call OpenDatabase
End Sub
Public Function LoadReport()
Set crxReport = New CRAXDRT.Report
Set crxApplication = CreateObject("crystalruntime.application")
Set crxReport = crxApplication.OpenReport("C:Report1Test.rpt", 1)
crxReport.DiscardSavedData
crxReport.Database.SetDataSource rsSelect
crvViewer.ReportSource = crxReport
crvViewer.ViewReport
End Function
Public Function OpenDatabase()
'Setup the GS database connection
Set cnGOS = New ADODB.Connection
sGSConString = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=noway;Password=nohow;Initial Catalog=GR;Data Source=GS"
cnGS.ConnectionString = sGSConString
cnGS.Open
cnGS.CursorLocation = adUseClient
sSQLSelect = "SELECT * FROM OMDR"
rsSelect.Open sSQLSelect, cnGS, adOpenDynamic, adLockReadOnly
rsSelect.MoveFirst
End Function
========================================================
Any suggestions would be appreciated!
Data Reports Active Reports Or Crystal Reports
Hi all
I am really stuck here and i need help urgently
I have to call three tables in a row to print a single invoice entry
noe the problem is if the do it by calling single tables then there is a problem that it is nopt going to print the last order which is filled.Is there is any way it can be done through using sql command or something.
Secondly if i use max order in sql then i would not be in a position to print order after searching for it
Thanx
In Crystal Reports, How To Display Financial Reports (P & L, Balance Sheet Etc.) In Columnar Format
Dear All,
I am developing a Financial application using VB6, MS-Access & Crystal Reports 8.5. I am facing problems in certain reports. Some of the reports like Profit & Loss and Balance Sheet require the output to be printed in columnar format.
I have tried giving subreports for each section, i.e.; Assets & Liabilities, but then, the output is not coming in order as per the groups. The problem is even more where there are sub-sections in the right side column & left side column for example in Profit & Loss, where there are sub-sections for Gross Profit/Loss and Net Profit/Loss. In such cases, how to bring the total amount fields at the same horizontal level.
I hope someone can help me how to do the above.
Thanks in advance.
Best Regards
Mahesh
Need To Understand Data Reports - Heard That Crystal Reports Were Slow
I have two questions:
1.) I was going to take a step forward to learn how to use crystal reports but I heard that on a website they are viciously slow. Is that true or is there a way around that with coding?
2.) I have been using Access reports through Visual Basic 6.0 with the following code - thanks for the tremondous help of everyone on this website:
Code:
appAccess.OpenCurrentDatabase SERVER & "disp-1_be.mdb"
appAccess.DoCmd.Maximize
appAccess.DoCmd.OpenReport "oalog", acPreview
appAccess.Visible = True
The reports work great UNTIL I came accross a situation where the report is based off of the data entry of the user. oalog is a monthly report and in the query it automatically pulls the current month with the following query:
Code:
SELECT oalogallmonths.ctsbranch, Count(oalogallmonths.Amount) AS [Total Of Amount], oalogallmonths.GivebyName, oalogallmonths.United, oalogallmonths.Mayflower, oalogallmonths.Other, oalogallmonths.Tord, oalogallmonths.CURRENTDATE, oalogallmonths.Amount, oalogallmonths.Month1, oalogallmonths.ORDER
FROM months, oalogallmonths
WHERE (((months.monthID)=[oalogallmonths].[Amount]))
GROUP BY oalogallmonths.ctsbranch, oalogallmonths.GivebyName, oalogallmonths.United, oalogallmonths.Mayflower, oalogallmonths.Other, oalogallmonths.Tord, oalogallmonths.CURRENTDATE, oalogallmonths.Amount, oalogallmonths.Month1, oalogallmonths.ORDER
HAVING (((oalogallmonths.Amount)=11;
If you notice the records are pulled HAVING the 11th month in there.
If I want the user to ENTER the month I know that I must change the last line to:
Code:
HAVING (((oalogallmonths.Amount)=[ENTER MONTH]));
But a user might type January or 12/2003, etc...
so I made a combobox named ListMonth of the 12 months.
Then I made the change from:
Code:
HAVING (((oalogallmonths.Amount)=11;
to
Code:
HAVING (((oalogallmonths.Amount)=ListMonth.ListIndex + 1));
The only problem is that I keep getting a message box asking for ListMonth.ListIndex + 1.
My question is in the above code that defines appAccess.DoCmd.OpenReport "oalog"...
is there a way to change the RecordSource of the report to pull from my own query instead of the Access Query?
Thanks,
Stephen
Crystal Reports - Upgraded To 8.5, Now Reports Written In 8.0 Wont't Work!!!
My reports are crashing when I run them on a machine with CR8.5, but they work fine on cr8.0. They crash inside the .DiscardSavedData Routine.
Does anyone know why or what I can do...
I call the report.Printout routine and right after I call the
.DiscardSavedData. The report is still printing out in debug mode.
Please help. Is my syntax wrong. The help file says I can only use Printout and DislcardSavedData in "formatting idle" mode. I don't know what this this???? The .PrintOut routine works but not the discardsaveddata.
Thanks,
Any help is appreciated.
M
How To Use Crystal Reports To Make The Dynamic Reports?(I Can't Use The Design Expert To D
How to use Crystal Reports to make the dynamic reports?(I can't use the design expert to design the report,because the data source with different fields is unknown in design time.)
Hello all!
I use the dynamic generating MS Access table as the Data Source of Crystal Report.
How to use the Crystal Reports to display the data of the dynamic generating MS Access table?
Thanks All!
China
Edited by - dehuiworkroom@hotmail.com on 12/17/2003 9:37:59 PM
Crystal Reports- I Need Help Running Reports With A Shared Database.
I am trying to figure out how to use a shared database in crystal reports. I have it set up for my application were I use: App.Path +
"databaseWMdbase.mdb" But in crystal reports it makes you use a drive name. I am trying to use the UNC but when I run it on the computer without the physical database it tells me Database not found... is there a way to set the Location of the database in the form load like you do with ADO? Any help or Ideas would be great.
I Hate Reports. Trash Crystal Reports, Access Instead?
I am creating an app which requires a copius amount of complicated reports. These reports would be an absolute breeze to do in access, simply create a query that does all the work then base the report on that. Instead of wasting time with Crystal Reports, I'd love to be able to create an access query and then run an access report based on that query from within my VB app. Now I have code that allows me to run an access report, but it seems to require that access is open on the users machine at that time. Is there any way I can achieve what I need without opening access each time ?
|