Crystal Report can't run from VB
hallo...K.Babu..
any idea how to solve my problem, descr as below;
I want to run a report ( Crystal Report 7.0) from my program
(code in VB 6.0).
But when I click a print button this error msg was appear ;
errMsg "Invalid report file name"
This are code of my program ;
Private Sub cmdPrint_Click()
On Error GoTo EmpPerDeterr
Cr.Action = 1
Cr.Reset
Cr.ReportTitle = "Catatan Aduan Pegawai MPSJ"
Cr.WindowState = crptMaximized
Cr.WindowTitle = "Catatan Aduan Pegawai MPSJ"
Cr.WindowShowGroupTree = True
Cr.Datafile(0) = App.Path & "\aswa.mdb"
Cr.ReportFileName = App.Path & "\Reports\Aduan.rpt"
Cr.Destination = crptToWindow
Cr.WindowShowRefreshBtn = True
Cr.WindowShowPrintBtn = True
Exit Sub
EmpPerDeterr:
MsgBox Err.Description, vbOKOnly, "OASYS"
End Sub
Re: Crystal Report can't run from VB
Hi,
action property should be at last line of all the cr.{properties}
cr.action = 1
yours friendly,
K.Babu
Quote:
Originally posted by pianme
hallo...K.Babu..
any idea how to solve my problem, descr as below;
I want to run a report ( Crystal Report 7.0) from my program
(code in VB 6.0).
But when I click a print button this error msg was appear ;
errMsg "Invalid report file name"
This are code of my program ;
Private Sub cmdPrint_Click()
On Error GoTo EmpPerDeterr
Cr.Action = 1
Cr.Reset
Cr.ReportTitle = "Catatan Aduan Pegawai MPSJ"
Cr.WindowState = crptMaximized
Cr.WindowTitle = "Catatan Aduan Pegawai MPSJ"
Cr.WindowShowGroupTree = True
Cr.Datafile(0) = App.Path & "\aswa.mdb"
Cr.ReportFileName = App.Path & "\Reports\Aduan.rpt"
Cr.Destination = crptToWindow
Cr.WindowShowRefreshBtn = True
Cr.WindowShowPrintBtn = True
Exit Sub
EmpPerDeterr:
MsgBox Err.Description, vbOKOnly, "OASYS"
End Sub
a Crystal Report Forum...
Quote:
Why don't they open a Crystal Report Forum?
It would be really very useful!!
sounds good. Let me suggest it to Brad
:cool:
HOPE SOMEONE ONLINE CAN HELP ME NOW!!!
HELLO, IF ANYBODY READ THIS MESSAGE NOW, WOUL DYOU PLEASE ANSWER ME QUICKLY...
HOW TO PASS A SUMMARY FIELD IN SUBREPORT TO MAIN REPORT ? I NEED TO CALCULATE THE GRAND TOTAL OF SUMMARIZE FIELD IN SUB REPORT, AND SHOW IT TO MAIN REPORT!
PLEASE NOTE THAT THE RECORD HAVE EACH GROUP. FIRST I WANT TO TOTAL THE SUM OF DETAIL IN SUB REPORT OF EACH GROUP, AFTER THAT THE GRAND TOTAL....
THE SUM OF EACH GROUP AND THE GRAND TOTAL MUST BE ABLE TO BE VIEWED ON MAIN REPORT.....
IT'S EASY TO LINK FROM MAIN REPORT TO SUB REPORT, BUT TO THE OPPOSITE....HOW TO PASS IT FROM SUB REPORT TO MAIN REPORT, IN CRYSTAL, NOT FROM VB... THANKS IN ADVANCE
crystal report w/ mas90 and access database
i am having a problem with a crystal report that at one point would run and now is giving me an error
odbc error:canada][pvx odbc driver][fileio] table is not accesible
after you hit ok on that
the second error is
error detected by database dll
what i am trying to run is a crystal report from a mas90 database with an access table. if anyone can shed some light it would be greatly appreciated.
thanks ralph
Multiple tables and databases.... 1 group
Using multiple tables and 1 group
Hi everyone.....
I am using Crystal reports embedded in VS .NET but I am actually having problems with my principal report
I´ve 2 DB, one DB is MySQL and the another is Access.
I have a table in my access database called "TblSpot", this table contains spot info (its columns are spotName, productName,ClientName, spotURL, spotVersion,spotDurationn) actually this table contains only 17 data rows.
I have a table in MySQL database called "TblSpotReproduction", it contains spot reproduction info (its columns are spotName. playerName, reproductionTime) also it has 150000 data rows.
I tried to make a report grouped by SpotName with only TblSpotReproduction:
SpotName <------ Init Group Header
---------------------------------------------
playerName reproduction Time
---------------------------------------------------
<---------End Group Header
ALL DATA
..
.
.
.
.
----------------------------
Group Foot
Next group etc etc etc
This report works perfectly. It shows the solution delayed but it works perfectly.
But my client ask me to make a better report that include spot information. For that i´d to include the Access database. My new report must be like this:
SpotName <------ Init Group Header
spotURL
spotVersion
Client
Product
spotDuration
---------------------------------------------
playerName reproduction Time
---------------------------------------------------
<---------End Group Header
ALL DATA
..
.
.
.
.
----------------------------
Group Foot
Next group etc etc etc
My problem is that this reports never open, i think that the combination of 2 databases causes CR crash, maybe the combination between 150000 rows with 17 rows make a impossible JOIN. Friends told me I have to use sub-reports but i have no idea how to use them on the fly. :confused:
P.D. Sorry for my really bad english.
Thanks for advance-----
Keylen
Crystal Report Password in Database
hi babu
pls pls help me......
where to write the code lines given by you to run crystal reports using a password protected database.
i am using a database which is password protected. i am creating a DSN for Crystal Reports. If i do not give password while creating DSN, it asks for it while running the reports.
can u help me in any way.... waiting anxiously for ur reply
bye
Re: password protected database
Hi curio11,
I am not sure as to what platform you are working on. I am using VS.Net 2003 and using C#. Here is what I did to solve this issue:
Right before I set the dataSource for my report. I did this:
myReport report = new myReport();
string login = "UserID";
string passWd = "Password";
report.SetDatabaseLogon(login,passWd);
crystalReportViewer1.ReportSource = report;
This did it for me. I hope this helps.
Take care.
Adios!
Salmaan.
Password Protected Database
Hi
I am working with VB.net 2002 and MS-Access(password protected). Have created a DSN to work with Crystal Reports. Now the problem is that it does not accept the following line code
CrystalReportViewer1.LogOnInfo(0) = "DSN = ABC;UID = ;PWD = XYZ;DSQ = "
have searched the whole thread, the only solution i found is this piece of code but it does not work et all...
do i require to import any files?? i am importing CrystalDecisions.CrystalReports.Engine and CrystalDecisions.Shared
my code is:
Dim rptTransporter As New rptTransporterCostingRpt()
CrystalReportViewer1.LogOnInfo(0) = "DSN = ABC;UID = ;PWD = XYZ;DSQ = "
CrystalReportViewer1.ReportSource = rptTransporter
CrystalReportViewer1.Show()
Thanks in advance
Bye
How do i dynamically through MFC/VC++ add and remove fields in the crystal report?
How do i dynamically through MFC/VC++ add and remove fields in the crystal report?
Can I call a function WhileReadingRecords?
Hi,
I have the databse (Oracle) in Unicode (UTF8 encoding) and using reports 4.5. So I am not able to get the strings in the report. First of all, Does crystal report 9.0 works fine with UTF8 encoding backend? (now i get the string as UTF8 characters)
Now, to escape from upgrading to reports 9.0, I have another way. I can convert the Unicode characters to ASCII and use my own font to display and print. (The conversion and fonts are working properly.)
I want to call my converter while reading database (for every string value of every records). The front-end is VB6 and the coverters are functions written in VB6 (also used other dlls).
Can you guys help me to get a solution?
Thanx in advance.
Regards,
Mahesh
flattening the rows from database
I am reading a record grouped by name and then by project name from Sql server DB. The database has records based on year of week. But the report should be based on pay period(dates). I have the logic to filter the data based on input pay period range. I used array to stretch the 3 rows from DB to 1 report row using
if({TimeSheet.Week} = {@beginWk}) then
populate week1 array;
else if({TimeSheet.Week} = {@endWk}) then
populate week3 array;
else
populate week2 array;
TimeSheet.Week - is the databasew field
Then I form the finalHrarray by stretching week1, week2 and week3 based on the pay period range. But in the report under the detail section it displays 3 rows from the DB for the project
like
projectA 0 1 2 3 4 5 0 0 0 0 0 0 0 0 0
projectA 0 1 2 3 4 5 0 0 0 0 0 0 0 0 0
projectA 0 1 2 3 4 5 0 0 0 0 0 0 0 0 1
Somehow it reads only 1 and 3 row and in some case 1 and 2 row. But I want
projectA 0 1 2 3 4 5 0 5 6 7 2 3 0 0 1 All three weeks in 1 row
sql command parameter issue...
Please help Babu:
For a couple days I've been battling with writing a report that has to tables linked by a left outer join. The left table simply holds all possible hours of the day (00 - 23). The right table holds all of my data.
My report groups on the hour of the day and it needs to show every hour of the day regardless of whether there is data there or not. I tried a bunch of things but I finally came to the conclusion that crystal was creating my sql syntax incorrectly.
I think I found a work around. I'm using an access database. If I write my own sql command I got it to work. Apparently, crystal was creating the wrong syntax for my sql statement when I used the select expert.
Crystal was creating the following query:
SELECT holdertable_hours.startingtimehours, recordcontrolnumber
FROM holdertable_hours LEFT OUTER JOIN Master ON HolderTable_Hours.StartingTimeHours=Master.StartingTimeHours
Where Master.GroupUsed='083';
If I create a sql command and put the where clause in the join statement it worked:
SELECT HolderTable_Hours.StartingTimeHours, RecordControlNumber
FROM HolderTable_Hours LEFT JOIN [Select * From Master Where GroupUsed='083']. AS Master ON HolderTable_Hours.StartingTimeHours=Master.StartingTimeHours;
I have two questions though:
1) Is it possible to change the sql that crystal generates without writing my own sql command?
2) If I have to write my own sql command, is it possible to create a drop down list for my parameter field, Master.GroupUsed? Originally I was not writing my own command and I had a parameter field where I could select my value for GroupUsed from a drop down list. Now that I have my parameter field as part of my command, it appears that crystal is making me type in the GroupUsed value. It would be nice to still be able to use a drop down list.
Thanks again for all of your help on this!
Steph-