|
-
Oct 11th, 2008, 08:46 AM
#1
Thread Starter
Lively Member
[RESOLVED] Displaying Report Dates
Once again don't know what to do here!
In my crystal report 9, I use a record selection formula to gather the data between two Dates. I do this by using the DTpicker control on my VB6 form.
The end user picks a start date and end date from 2 dtpicker controls on the vb6 form and that information is inserted into my record selection formula which gathers all the correct records from the database by using the DateTime field in the database.
My problem is on the REPORT I want to print the start date and end date this data is for. Is there someway I can print the dtpicker.value properity on the report?
Any Ideas
Thanks
-
Oct 11th, 2008, 12:34 PM
#2
Re: Displaying Report Dates
3 options.
Add some parameters to the report, set their values from the date picker controls and then print them (you could also use them in the selection formula).
Create Formula's and set their code like you seem to be doing with the Record Selection Formula.
You could utilize the ReportTitle special field. This is handy if you need to print a description of the report, typically placed in the Page Header.
Last edited by brucevde; Oct 11th, 2008 at 12:39 PM.
-
Oct 13th, 2008, 10:02 AM
#3
Thread Starter
Lively Member
Re: Displaying Report Dates
Option 1:
Maybe I don't understand! If I add a parameter field to the report will it not ask for a parameter to be entered? How can I insert a parameter field into the report and NOT have it ask for a parameter to be entered?
Option 2:
I do use a formula for my record selection, and it comes from 2 dtpicker controls. The problem is how do I print on the report the dtpicker1.value as start time and dtpicker2.value as end time?
Option 3:
I don't know if the ReportTitle special field would work either because this has to be a varaible it is going to change almost every time they take a report.
Maybe you could explain in a little more detail!
Thanks
-
Oct 13th, 2008, 12:50 PM
#4
Re: Displaying Report Dates
What are you using in your VB app to manipulate/view the reports? Are you using the CRAXDRT object library?
-
Oct 13th, 2008, 12:58 PM
#5
Thread Starter
Lively Member
Re: Displaying Report Dates
Yes! That is what I am using and this is for Crystal Report 9.
Thanks again.
-
Oct 13th, 2008, 07:13 PM
#6
Re: Displaying Report Dates
Just define a formula field in Crystal Reports, let's name it : crTitle and place it in the desired Section
Code:
Trim("Report Title")
And in the VB6 app :
Code:
'GEnt2 is an Integer
'CRReport is the Report object
'Chr(39) is a '
For GEnt2 = 1 To CRReport.FormulaFields.Count
Select Case CRReport.FormulaFields(GEnt2).Name
Case "{@crTitle}": CRReport.FormulaFields(GEnt2).Text = "Trim(" & Chr(39) & "from: " & Format(dtpicker1,"dd/mm/yy") & " to: " & Format(dtpicker2,"dd/mm/yy") & Chr(39) & ")"
End Select
Next Gent2
By this way we can change, from vb code, any formula text we had defined inside Crystal Reports rpt
JG
Last edited by jggtz; Oct 13th, 2008 at 11:21 PM.
-
Oct 14th, 2008, 07:05 AM
#7
Thread Starter
Lively Member
Re: Displaying Report Dates
First, I want to thank everyones HELP! I did not use (jggtz) suggestion because I figured out a solution before I read his post. ( I do think his suggestion would probably work, I have not tried it)
But here is what I did.
In my Vb6 application I use two DTPicker controls to select a STARTDATE and an ENDDATE, this information is then inserted into a record selection formula for my crystal report.
Now on the Report itself I created 2 new formula fields one called {?StartDate} the other called {?EndDate} the formula for the {?StartDate} is Minimum ({MyDateFieldinDataBase}) and the formula for the {?EndDate} is Maximun({MyDateFieldinDataBase}) I now insert these two fields onto the Page Header and it Prints the start and end dates of what ever data is passed thru the record selection formula.
I hope this will help someone else.
-
Oct 14th, 2008, 12:33 PM
#8
Re: Displaying Report Dates
One thing to consider:
What if in the vb app we select a date range, let's say Jan 1 to Jan 7
And in the table there are data from Jan 3 to Jan 7
The report title will say Jan 3 to Jan 7 instead of Jan 1 to Jan 7
Is this acceptable to you?
-
Oct 14th, 2008, 01:16 PM
#9
Thread Starter
Lively Member
Re: [RESOLVED] Displaying Report Dates
You are correct! However, That is what I want because if the Database does not hold records starting at Jan 1 the report will show the beginning date for the data in the database.
Thank you for your concern.
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
|