|
-
October 13th, 1999, 09:30 PM
#1
Crystal Reports
Hi all... I hope someone can help me... I have 2 questions about Crystal Reports:
1) I have a database which has some fields, one of them is a User Name field. I want to be able to create reports either by Ascending order or Descending order. At the moment, I have created two RPT files, for each sorting method. Is this correct? can I "instruct" Crystal Reports to sort "on the fly"?
2) How can I run Crystal Reports by using the API? I'm using Visual Basic 5.0 and Crystal Reports 4.6... I don't want to use ActiveX control.
Thanks a lot in advance
Jaime
-
October 14th, 1999, 07:35 AM
#2
Re: Crystal Reports
Use SortFields property of Crystal Control. Something like this:
private Function SortFormula() as string
If cboSort.Text = "Sort By Account Name" And optAscending = true then
SortFormula = "+{Account.AccountName}"
ElseIf cboSort.Text = "Sort By Account Name" And optAscending = false then
SortFormula = "-{Account.AccountName}"
End If
End Function
private Sub cmdRunReport_Click()
'do all preparation here and run report
crReport.SortFields(0) = SortFormula
crReport.Action = 1
End Sub
I know nothing about using API
Vlad
-
October 14th, 1999, 05:21 PM
#3
Re: Crystal Reports
Thanks for your answer.... let me ask you another question about CR.... I have in my database a DATE/TIME field... when I design the report and when I execute the report, only the Date is displayed... the DATE/TIME field contains a full date and time.
Jaime
-
October 15th, 1999, 06:35 AM
#4
Re: Crystal Reports
Right click on the field, select Format, and there you'll be able to change format for displaying Date
Vlad
-
October 15th, 1999, 08:32 AM
#5
Re: Crystal Reports
Yeah.. I do that... but it only gives me the chance to change the Date format (DMY, MDY, etc)... what about the Time? I need to display the Time too.
Thanks
Jaime
-
October 15th, 1999, 09:01 AM
#6
Re: Crystal Reports
I don't remember how it's done in versions wich come with VB, but in Crystal 6 and 7 there is Date/Time tab with Combo box that has Date Time, Time Date, Date and Time items. You can select one of these settings.
Vlad
-
October 15th, 1999, 03:35 PM
#7
Re: Crystal Reports
Hi..
I have just installed CR 6.0 and the same happens... the supposed Date/Time tab is only shown as a Date tab. I go to Format option when cursor is on the Date/Time field in the report designer. A dialog bos is displayed which shows a tab control with 4 tabs, Common, Date, Border, Font. The focus starts on the Date tab. All options in that tab let me modify Date format. It says nothing about Time. Someone can think that the Date/Time field in the database is defined to contain only a Date, but if I browse the data in the database (by using for example, VISDATA), it is shown both the date and the time. If I browse the data by using CR designed, only Date is shown. I think that a solution sould be to define 2 fields, a Date field and a Time field but in that case, the informartion will be in 2 columns, and that isn't the idea. Any further help will be greatly appreciated.
Thanks
Jaime
-
October 15th, 1999, 03:53 PM
#8
Re: Crystal Reports
What kind of database do you use. In Access there is no Date data type (Date/Time only), in SQL 7 too (only DateTime and SmallDateTime). Maybe your application inserts only Date in a database. If so, try manually update some records with data containing both Date and Time and check the behaviour of CR after that. Maybe it doesn't give you the choice to select Date Time, because it doesn't see any time in a database.
Vlad
-
October 15th, 1999, 05:27 PM
#9
Re: Crystal Reports
It's an access database, and I defined the Date/Time field. I have created it using Access 2000 and then exported to Access 97. In Access 2000 I have the chance to select what Date/Time format I want. I selected full date (date following by the time)...
I populated the database and I see the Time when browsing either in my program that use the database or the VISDATA program (which comes in VB). So I cannot find a reason of why the Time isn't read by CR.
Thanks
Jaime
-
October 15th, 1999, 05:55 PM
#10
Re: Crystal Reports
Does CR give you Date Time option in a Combo now? You can try to use formula field instead of using data directly. One more stupid advice: check if the size of the field is enough to display everything. Data may be truncated. I had such a problem a couple of years ago. If everything I told doesn't help, sorry. I have no more ideas.
Vlad
-
October 18th, 1999, 08:18 PM
#11
Re: Crystal Reports
Back to the first question. Besides of ordering by fields, I need to order by group. I'm trying:
crReport.GroupSortFields(0) = "-GroupName ({REPORTE.PIN_Usuario})"
PIN_Usuario is a field of REPORTE table, but crystal reports send the error that the field doesn't exist. How is it then?
Thanks
Jaime
-
October 19th, 1999, 10:25 AM
#12
Re: Crystal Reports
Unfortunatly I cannot see remotely what you do. Maybe wrong spelling of a field name, maybe something else. I could answer general questions, not details. Sorry.
Vlad
-
October 21st, 1999, 07:50 PM
#13
Re: Crystal Reports
I don't think this is a detail... the name of that field is right.... if you want to verify that, I can send you the database structure, but it's only a losing of time. Maybe is a sintax error or something like that. for example, I got that error when I used ( instead of { in the SortFields property. In this case this is correct.
Jaime
-
October 22nd, 1999, 07:40 AM
#14
Re: Crystal Reports
OK, send me db, report and vbcode. My address [email protected]
Vlad
-
October 27th, 1999, 04:36 PM
#15
Re: Crystal Reports
You may want to check in the Report Options sub menu of the File Menu see if the Convert Date-Time is set to Date rather than Date-Time.
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
|