PDA

Click to See Complete Forum and Search --> : Crystal report Help please


alexanderjames
Oct 4th, 2005, 09:03 AM
Hi

Please could someone help me with the following.

I have a crystal report8 on my form which i connect to an Access
database with ADO, This works and reports on all the information
correctly, But now what i need to do is, on my form i have a textBox
for "room number" and two dtpickers for a start date and an end date.
and a command button to view the report, So the idea is to select
a room number and then the dates, and to report on all the transactions
Only for that room number between those dates.If this is possible
please help.

Many thanks in advance

GaryMazzone
Oct 4th, 2005, 09:37 AM
What you are asking is possible. What method are you calling the report from (API's ot OCX). That will make little bit of difference in how you set the where condition for the report. Using the OCX you call the activeX as follows:


strW = "{TempSumExpo.TempID} = '" & Trim(Replace(strTKey, "'", "''")) & "'"
fMainForm.crRep.ReplaceSelectionFormula strW


Change the strW to the fields in your database.

alexanderjames
Oct 5th, 2005, 01:26 AM
Hi GaryMazzone

Thank you for your reply, So far i have just added the report to my form from the Add designers menu, But do you think it is better to use the OCX? I will try it this evening.

Thank you

pnish
Oct 5th, 2005, 01:42 AM
The Crystal OCX is considered legacy. It hasn't changed since Crystal v6. I'd stick with the Report Designer Component.

alexanderjames
Oct 6th, 2005, 02:57 AM
Thank you

I set it up last night using the designer which connects to my database, and
Automatically gets displayed on form1 that is fine. Please can someone
Help me I am really in the dark on this one. This is what I have,

A form called FrmainReports with a combo box for selecting a “Room Number”
A DTPicker for start date and a DTPicker for end date, then a command button
Which brings up Form1 with the report in it. The report shows everything
In the database correctly. The fields that I want to report on in my access
Database are “Room number” and “Date” this is what I am trying but no such
Luck, any advise will be much appreciated.


visual basic code:
________________________________________

Room number , Date = "{TempSumExpo.TempID} = '" & Trim(Replace(strTKey,
"'", "''")) & "'"
Form1.CrystalReport1.ReplaceSelectionFormula Room number, Date
________________________________________
Many thanks

divined
Oct 6th, 2005, 05:08 AM
I suppose that you`re using the CRViewer control to display the report on screen. I also assume that you`ve created the necessary query in the access database. In that case you need to set the DataSource property of the embedded CR 10 report control to the query of your database.

This is how I do it. I`m using an ADODB.Recordset control here to set the recordset directly.


' CrystalReport1 is an embedded CR 10 report
CrystalReport1.SetDataSource rsListaEpiskeywn, 3, 1

' Set Crystal Report Viewer control source to the report above.
crViewer1.ReportSource = CrystalReport1

crViewer1.ViewReport


Hope this helps a bit.

alexanderjames
Oct 6th, 2005, 05:25 AM
Hi Divined

thank you, the only thing i have'nt done is the query in the access database, i am slightly fimiliar with queries, if you can just guide me thruogh, do i have to query the fields that i want to report on?

alexanderjames
Oct 6th, 2005, 05:28 AM
just want to know, is rsListaEpiskeywn the name of your query in the access database?

divined
Oct 6th, 2005, 08:47 AM
No. I was not using Access for this project. I`m accessing a MySQL 4.1 database using an ADO Recordset object. The query was made from within the program and was not a stored procedure.