|
-
Oct 4th, 2005, 09:03 AM
#1
Thread Starter
Hyperactive Member
Crystal report Help please
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
-
Oct 4th, 2005, 09:37 AM
#2
Re: Crystal report Help please
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:
VB Code:
strW = "{TempSumExpo.TempID} = '" & Trim(Replace(strTKey, "'", "''")) & "'"
fMainForm.crRep.ReplaceSelectionFormula strW
Change the strW to the fields in your database.
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Oct 5th, 2005, 01:26 AM
#3
Thread Starter
Hyperactive Member
Re: Crystal report Help please
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
-
Oct 5th, 2005, 01:42 AM
#4
Re: Crystal report Help please
The Crystal OCX is considered legacy. It hasn't changed since Crystal v6. I'd stick with the Report Designer Component.
Last edited by pnish; Oct 5th, 2005 at 01:50 AM.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Oct 6th, 2005, 02:57 AM
#5
Thread Starter
Hyperactive Member
Re: Crystal report Help please
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
-
Oct 6th, 2005, 05:08 AM
#6
Hyperactive Member
Re: Crystal report Help please
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.
VB Code:
' 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.
-
Oct 6th, 2005, 05:25 AM
#7
Thread Starter
Hyperactive Member
Re: Crystal report Help please
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?
-
Oct 6th, 2005, 05:28 AM
#8
Thread Starter
Hyperactive Member
Re: Crystal report Help please
just want to know, is rsListaEpiskeywn the name of your query in the access database?
-
Oct 6th, 2005, 08:47 AM
#9
Hyperactive Member
Re: Crystal report Help please
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|