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.
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'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.
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
Changing Database Location In Crystal Reports Ocx
Hi,
I have the following problem.
When I change in code the location of the database in my code and set the datafiles(0) property acordingly
I get the "error detected by database dll". Why?
If I don't change the location it works fine.
VB4-32 and Crystal Reports 4.5
Dynamically Setting Database Location In Crystal Reports Using Vb6
Hi
I am using vb6 as my front end, sql server and crystal reports 8. I am having a problem setting the db location through vb6.
It keeps defaulting to the location that was used when the report was created.
I've been able to solve the problem with vb6+access, vb.net+sql server, vb.net+access.
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
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 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 - 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
Crystal Reports..opening Reports Runtime
hi
I want to know is there anyway where i can make a query and attach that recodset to the report .I dont know much about ttx and would like to write the code with opening a crystal report application.
I have just added a reference of Reports dll and dont want to use Crystal Report control in the project.
I have made report with ADO option.
hopefully someone helps me in this direction
Thnaking you
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.
How To Change Database Location At VB Runtime?
Hi to all,
I have a crystal report viewed in VB. Report is working well on my development PC but when I deploy the application in the Client's PC having different Path, the report can't find the database... and it results to an error.
Example:
Database and Report location is "C:REPORTS"
But when I deploy the Application to a different path like
"C:PROGRAM FILESMY SYSTEM"
the report will not be displayed...
So, is there a way I can change the database location of a CRYSTAL REPORT so that where ever I change the path, the Report can still be viewed.
Thanks in advanced.
Noel
Changing ODBC Driver File Location @ Run Time (Crystal Reports)
I have two reports written in Crystal Reports version 8.0 that use the MS Text ODBC driver as their database. The formatting is appropriate and the reports work fine. However, I am on a mission from my boss to see if I can change the location of the text file on the fly. For example, if it is designed to point to H:Reports and I want to change it to C:Software on the driver, how would I do that? I've explored the Set Location option, but didn't find anything helpful. It appears that the change would have to be on the DSN.
Your assistance is greatly appreciated!
Sherri
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
Is It Possible To Change The Database Location At Runtime In CrystalDesigner From VB6
Hai All,
I am developed a project in vb6 with MsAccess and the reporting tool is CrystalReport 9.
For designing the report I am using the CrystalDesigner in VB6 and using CrystalReport Viewer Control
to display the report, When designing report the Database location is set through OLE DB in the
CrystalDesigner itself. The problem is my boss is asking me to give the Project in CD to take and he will test in some other pc, for that i created the package and tested in a different machine , the other things are working except the report, the problem is the Database location, Is It Possible to change the Database location(which has set previously when designing) at runtime in CrystalDesigner from VB6. if i give the CD then it should work. If using ttx is the only way then pls give the sample to create ttx.
Thank you,
Chock.
Crystal Reports At Runtime
I want to create a crystal report based on what the user has selected on the form.I am getting the required data from the database using a recordset.
NOw how do I place this recordset on the reprt with the feilds dynamically.
Another thing how do I put a header and footer dynamicallyon the report.
Please give me an idea of how the code will go ?
I am not getting the option of sqlquerystring in crystal report control!
Changing Database Name And Location Runtime For Crystal Report
i m devloping one application in vb 6 and ms access , which uses 2 database. at runtime according to condition i want to fetch data from different database. i tried to changed datasource at runtime, it does not give any error but it gets data from the design time database only. my code is as below to change datasource.
Dim sql As String sql = "sElect * from Certificate"
Set adoRs = CreateObject("adodb.recordset")
adoRs.Open sql, "Provider=Microsoft.Jet.OLEDB.4.0;Password='' ;Data Source=" & App.Path
& "gramcommon.mdb;Persist Security Info=false", adOpenKeyset, adLockBatchOptimistic Me.Database.SetDataSource
adoRs adoRs.ActiveConnection Me.Database.AddADOCommand adoRs.ActiveConnection, adoRs.ActiveCommand
Me.Database.Verify Me.VerifyOnEveryPrint = True
pl. help me, if this way or any other way to change database of crystal report with .dsr file exten.
if possible pl mail me on meenxip@yahoo.com
Crystal Reports (Designing At Runtime)
I'm using VB 6 and Crystal Reports 9 and I have the next problem.
I need to create some lines for the report at runtime. So I type the next code:
Private Sub DetailSection1_Format(ByVal pFormattingInfo As Object)
Dim x As CRAXDRT.LineObject
Set x = Me.Sections("DetailSection1").AddLineObject(7000, 6000, 10000, 6000)
End Sub
The References I have in my project are:
* Visual Basic for Applicatios
* Visual Basic runtime objects and procedures
* Visual Basic objects and procedures
* Microsoft ActiveX Data Objects 2.0 Library
* oLE Automation
* Crystal Reports 9 Designer Design and runtime library
* Crystal Reports 9 Designer run time library
* Crystal Reports 9 Viewer Control
When the SET x line exceute it returns the next error: -2147189571 Creation feature not enabled.
How should I enable the creation feature????? I hope someone can help me, thanx
Creating Crystal Reports In Runtime
hi,
i wanna create crystal reports in runtime
that s when i am running the program once i give the parameter such as the repot type(bar ,pie,line etc) and the data the program should automatically give me the crystal report.
Can any one plz tell me how to do this.
so far all i know is to make a report in crystal reprt use the crytal report control and put it in the program..
I WANT IT TO BE DYNAMIC ....PLZ PLZ PLZ HELP!!
Crystal Reports Runtime Error
I have developed on exe application using vb6.0 which includes crystal reports and i have used business object's crystal reports version XI while developing. Reports are working fine while running the application.
whenver i make it as a setup file and run from exe of this application it is giving run time error as
Runtime error : 2147206460 (80043ac4)
Invalid directory
details : error
help me.
Anyone Have Crystal Reports 8.0 Runtime.hlp File?
I am looking for the runtime.hlp file for crystal 8.. because it has detailed info on files and versions for distributing the cr engine during installation, but for some reason, it comes with the development edition of CR and not the professional version...
Crystal Reports Image At Runtime
Hi,
I am using VB6, Crystal Reports 8.5, .rpt report files and the CRViewer to show the reports. Data source is either Access or SQL.
I need to be able to set an image in the report at runtime to the logo of the company selected. I am happy to use either an image in a directory (path provided) or an image stored in a database (passed by ADO Recordset).
Can anyone tell me how this can be done, or just start me off on the right track as I am stumped!!
Thanks in advance.
TC
I had posted this in the Crystal Reports section but to no avail!!
Crystal Reports - Design At Runtime
I'm using VB 6 and Crystal Reports 9 and I have the next problem.
I need to create some lines for the report at runtime. So I type the next code:
Private Sub DetailSection1_Format(ByVal pFormattingInfo As Object)
Dim x As CRAXDRT.LineObject
Set x = Me.Sections("DetailSection1").AddLineObject(7000, 6000, 10000, 6000)
End Sub
The References I have in my project are:
* Visual Basic for Applicatios
* Visual Basic runtime objects and procedures
* Visual Basic objects and procedures
* Microsoft ActiveX Data Objects 2.0 Library
* oLE Automation
* Crystal Reports 9 Designer Design and runtime library
* Crystal Reports 9 Designer run time library
* Crystal Reports 9 Viewer Control
When the SET x line exceute it returns the next error: -2147189571 Creation feature not enabled.
How should I enable the creation feature????? I hope someone can help me, thanx
Crystal Report Change The Location Of Database
hi
My name is prince. I have one problem with Crystal report .
we are doing one application using VB and SQlserver 2000, in that we are dynamically creating the database and in the time of logging configure the DSN using SQLConfigDatasourse API.
but the problem is Crystal report not get updating. it willgive the value from the database when we connected at design time.
plz give a better solution.
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.
Suppress Fields During Runtime In Crystal Reports.
Is there a way to suppress fields in a report during runtime?
Something like this would be sweet:
Code:
report.fields("field").suppress = true
Or do I have to create parameter fields which the fields in question depends on?
That is _not_ an optimal solution. To much work to make a report.
I have had a similar question like this up before with no luck
Please help me, i must come up with a solution to this.
/Mats
Crystal Reports 8.5 - How To Set Date Period At Runtime
Hello,
I am trying to adjust the date range or period of a group in a crystal report at run time.
I am using a .RPT file, saved without the data, as a template. I was able to figure out how to adjust the date scope of the whole report but now I want to be able to have the user adjust the summary period interval at run time - say from weekly to monthly.
I am doing this in VB6 and Crystal Reports 8.5
I explored a bit and found a collection, ReportObject.GroupNameFields, the 'name' property had the word 'weekly' at the end of a string but I do not know if I just need to replace that part of the string or are there more factors than just this property?
Thanks in advance for any help,
Regards, Tom
Runtime Design Of Report In Crystal Reports 8.0
Hello All,
I want to change design of report through VB, I mean to say how can I change any textbox location to other location within same report only?
My problem is that we have more than 50 reports & if any customer wants to change location of textbox to other location within same report then he not able to do that & for that small reason support engineer have to visit him for minor change in report.
So saving time as well as man power, can we provide such interface where user can do minor changes in report ?
Any ideas are appreciated...thanx.......
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 (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
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
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
Changing Data Source Of Crystal Reports At Runtime
hi ,
i am using crystal reports to display some data.
the data which is to be displayed comes from different database tables depending on the users selection.
i am using visual basic 6 to provide selection options to the user.
how can i change the datasource of the crystal reports at runtime..
initially i have build my report using table a. suppose the user wishes to see data from table b then he should be able to do that.. tables a and b have the same structure...
i tried collecting the data from table b in a adodb recordset and
then set the datasource property of the report to point to this recordset. but the report is not displaying any data...
following is the code which i tried and was unsuccessful...
objRec1 is an adodb recordset and crAnalysisReport is my analysis report..
Set objRec1 = objConnmbtemp.Execute("select * from tableb")
crAnalysisReport.Database.SetDataSource objRec1, 3, 1
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
Crystal Reports Cross-Tab: Suppressing Row Grand Totals At Runtime
I have a cross-tab which is either going to be populated with percentages or currency values (depending upon user selection). When currency values are being loaded into the cross-tab I would like it to show row grand totals, but in those cases where percentage numbers are being loaded into the cross-tab I would like to suppress row grand totals. I have a field in the table the cross-tab is derived from which contains either a "N" for currency fields and a "P" for percentage fields.
IS THERE A WAY TO SUPPRESS ROW GRAND TOTALS AT RUN-TIME IN THOSE CASES WHICH THE USER IS LOADING PERCENTAGE NUMBERS INTO THE CROSS-TAB?
Crystal Reports: Adding Groups At Runtime And Starting A New Page
Hi!
I'm trying to create groups in Crystal reports at runtime. I need to read the groups from the database for the query, get the dataset based on them and then make report display the appropriate number of groups. Any ideas how to do it?
Another problem is to start a new page after some of the groups. How would you trigger this?
I appreciate your help!
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
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?
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
Problem: Crystal Reports 9 & Vb6 (only After Installation Of Centura Runtime) - Some Integers Empty
Hello!
I am using Crystal Reports 9 (under Win2000 with SP3/SP4 - no
difference) and try to create some reports from vb6. Everything works
fine..., unless I install the centura runtime (deploy20.exe).
After the installation some (there is no telling which) integers are
missing in the report. When debugging my visual basic sources
(SetPrivateData) everything is fine and all the integers are filled
with the proper values. (I am using ttx files and they are also all
okay.)
Has anyone already experienced this problem?
and (more important) does anyone has a suggestion on how to solve this
problem??? (must be something with the ADO, mustn't it?)
Greetings and thanks
Michael
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
|