Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Format Decimal Point In Crystal Report

hi dude... can i know got anyway to use VB format the number of decimal point in crystal when display value...?


I can display 23.1
as well as 23.1000

everytime I can adjust the decimal dynamic.. ..

thanks a lot... hope u will solve this small problem for me... have a nice day~~~

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Unable To Open The Crystal Report Exported In Crystal Report Format
Sub: Unable to open the Crystal report exported in Crystal Report Format

1)    I have used Oracle Native connection, while designing the report.
2)    I have passed the record set to the report at run time.
3)    Exported the report to Crystal Report Format, But I could n’t able to open report, while opening , the report asks for OLEDB information, even though I used Native connection at design time.
4)    In Crystal Report 8.5, connect driver property, but I am using crystal reports XI and in Visual Basic 6.0, Is there any method or property to convert the connection?. As I have to export report to crystal format and emailed to user, so that user can open it.
Any assistance in this regard is highly appreciated

The code is as follows:
Public Sub Aging_REPORT(strSQL As String, sReportName As String, sDestFileName As String, ReportTitle As String)

On Error GoTo Err
Dim CrAppl As CRAXDRT.Application
Dim crrep As CRAXDRT.Report

Dim rsCrystal As ADODB.Recordset
    Set CrAppl = New CRAXDRT.Application
    Set crrep = CrAppl.OpenReport(sReportName) 'Opens the report
   Set rsCrystal = New ADODB.Recordset
    rsCrystal.Open strSQL, Conn, adOpenStatic, adLockReadOnly
     With crrep
    .Database.LogOnServer "crdb_oracle.dll", strServerName, "", strUserName, strPassword
     .ReportTitle = ReportTitle
     .Database.SetDataSource rsCrystal, 3 'LINK REPORT TO RECORDSET
     .VerifyOnEveryPrint = True
     End With
   With crrep.ExportOptions
    .DestinationType = crEDTDiskFile
    .FormatType = crEFTCrystalReport
    .DiskFileName = sDestFileName
   End With
   crrep.Export (False)
    Set crrep = Nothing
    Set CrAppl = Nothing
    Exit Sub
 MsgBox Err.Description

End Sub


How To Pass Format String To Crystal Report From VB And How To Use It In Crystal Report?

I am working on VB 6.0 and using crystal report 7 as reporting tool.
In report, some clients are asking 3 decimal places(Eg. 2000.500) while other clients are asking 2 decimal places(Eg. 2000.50) for numeric fields.
I want to pass the amount of decimal places for numeric fields to crystal report from VB.
How should I implement this using VB.
Pls any one can help me?

Thanks in vance,

How To Save Report In Jpg Format, Generated Using Crystal Report In VB Application
Hello dear,
I am using VB6 + CR9 to generate a photo-ID report and want to save the report in jpeg format. Pls. let me know, How can it be possible?

Crystal Report 8.5 Error While Exporting A Report In PDF Format
can anybody help me??
I have generated one report in crystal report 8.5 .Now crystal report is giving a facility to export it in different file formar like excel,PDF,RTF.Here I am facing one problem I am able to export the report in all file format except PDF and RTF.When I am selecting a PDF file format it is asking me for disk file, MAPI .After this i select the disk file option ,then its asking me for all pages or range of pages.After this nothing is appearing on the screen...

Can anybody please help me..

Prob. In Export A Report In RTF Format Through Crystal Report 8.0
I have a prob. in exporting a report in rtf format through crystal
report 8.0 on some client machine...

i am able to export report on my pc. but not on client machine....

plz suggest

Best Regards,
Sachin Jain

Crystal Report Format

I created one cross-tab report. in that report, i mainted some line height. previously, it was working fine. Recently, I installed .net on my system. After that, In runtime, line height is being reduced. In preview, it is working fine.

How can i solve this problem?

please give me the solution if anybody knows.



Format A Field In Crystal Report
My Crystal report version is 5.1

I need to format a fiel number and it is a telephone number. What is the correct formula or function to format this field in my version.

The data fiels belong to a table from msaccess or mdb

actually the number is printed like this 2136407658
I need in my report to print like this (213) 640-7658

Someone gave me this example but this is not working

Picture("2136407658","(XXX) XXX-XXXX")

I have not this picture fuction in my Crystal report Program, I have only number group Fucntion.

VB6 And Crystal Report 8.5 RTF Format Problem
I am using Visual Basic 6 with Crystal Report 8.5
I am saving certain data in VB6 in the RTF format. But when I view the same in CR8.5, CR is not able to interpret the RTF format correctly. A few tabs are changed and Underlined data is not recognized properly.

What can be the problem?


Time Format In Crystal Report
I want to make Time Clock Report so my field needs to show total of Time. If I set my field into Time Format and my total time is over 24:00 I have problem, because time format do not allow over 24 hours.
Is there any trick how I can get total time in good format.
If I go with numbers in calculation I got this:
Dim a as number
Dim b as number
Dim c as String

a = 35 (hours)
b = 25 (minutes)

c = a & ":" & b

For samo reason in this case I got this 35.00:25.00

Crystal Report 8.5 How To Format Section ?
Hi, All

I want to know how can I arrange the section like this in crystal report:

Page Header a
Detail a
Page Header b
Detail b

Normally ,when I insert new Page Header and Detail , it will be arrange like this :

Page Header a
Page Header b
Detail a
Detail b

I want to split these two header also with the detail , is it possible to do ?

If anyone know about this ,pls let me know
Thank you very much


Format Date In Crystal Report 8.5

1)I've a report with a Group Header which displays Date, and the detail section will display the sales report for that particular date.

The default Date format as set/designed in Crystal Report 8.5 is DD MMMM YYYY. I would like to change the format from VB during runtime.

What's the command that I can use?
The field name is TransRef.Date is a table field.

2)I realised that, if I m displaying the report by year, multiple similar entries are not grouped together, eg:

I've got these fields
[Item Code], [Brand], [Quantity], [Price]

I would like the Quantity field be summed up, which is equivalent to SUM([Quantity]) then ORDER BY [Item Code], [Brand], [Price] as in SQL. How do I accomplish this in Crystal Report designer or do it from runtime perhaps?

Thanks for all replies.


Crystal Report Numeric Format
We are using VB6 and crystal report 8.0. We have one numeric field in crystal Report. I want that comma's in that field to come according to Indian Comman Style.
Eg for 10 Million crystal report will show 10,000,000 but according to Indian Comma stryle I need show 1,00,00,000 How to make this localized data output format? (i.e first comma after 000's and then other commas after 00's eg 11,22,33,44,555 )

Thanks and Regards,

Export Crystal Report To PDF Format
Does anyone know how to export a Crystal Report file to PDF format?

Thank you


Doubt In Crystal Report Format
Im using Crystal Reports 9 , MS Access 97 and VB 6.
Is it possible to retrieve a field in a row in the crystal report.i.e., a column in the tableshould be displayed in a row in the report.


Grid Format In Crystal Report
hai all

I am using crystal report 7 version.Is it possible to display the records in detail section as GRID format.I need it to look like a table wiht rows as field values and columns as headings.Actually i tried it by drawing a line after the records by menas of the line control.But u see for one of the textbox in my report its width is larger than anyother and so the line is not even when there is no large sentence in the textbox which has larger width

And moreover i need two color a single row that is i may have some value like 'mtype='C' in my recordset.In suhc case that record alone shd be displayed differntly.Actually i dont know to pass a recordset to crystal report.Instead i am just assiging the tabeel to be connected to my report and i am fetching the fieldnames from the table and just assiginig them to the report.

Nanree(Thanks In Our Language)

Edited by - ramya_c2004 on 2/18/2005 1:18:11 AM

Crystal Report Format Problem
This is a invoice form.

Report header - blank
Page header - title and invoice number
Details - display the item
Report footer - remark
Page footer - Total and signature

everything was OK when only printing 1 page. But when more than 1 page, the "Total" will display twice time, mean page 1 got total, then page 2 got total also. But i only want page 2 display "Total". If put "Total" in Report footer, that format was not i wanted.

anyone can help me ? thank so much

Crystal Report Export To .RTF Format
While exporting report from crystal to .rtf format in MS Word, It exports the text boxes also to the .rtf file..Is there any way to avoid this and only plain text shud get exported to the rtf file rather text with text box.

How To Export Crystal Report Into .rtf Format
When I tried to save as a .rtf file, it is displaying strange characters. how can i export to a .rtf or .doc formats?


Printing Resume Format Using Crystal Report And VB6
Hi guys!

im new to reporting and i usually do my reporting on File I/O. but there is one thing that i cant do with this kind of reporting.... and that is printing a resume format with picture on it

the information such as personal information, family background, work experience, trainings and seminars are in different database tables with multiple fields on it... but there is a common relationship with each other (primary key is employee id)

how can i generate a resume like report in crystal report. i have crystal report 10 here but i dont know how to use it yet. (i can only do simple queries but not that knowledgeable enough )

i hope that you could guide me in solving this problem

Crystal Report Numeric Field Format
i want to format my numeric field. can we format the field with coding in crystal report such format in the fields's property. i want to remove , from my numeric field in a formula and format it as in vb format(field, "00000"). how it in crystal reports?

Print Time Format In Crystal Report

You can try Seagate Crystal Report 6.0
There is a function to format time.

But I think now the latest versin is 7.x !?

Does it help ?


Date Format Passing From VB To Crystal Report

I want to use the formula with the crystal report.
I am using
CrysRpt1.SelectionFormula = "{format(paid_sal.Paid_date,""mm/yyyy"")}>= '" & Format(dtpfrom, "mm/yyyy") & "'"
This is giving errors of unknown field. How can I pass the SQL query with date?


Crystal Report Format Problem In Detail
crystal report format problem again

Detail :
Item Description - i use 4 field display as row
row 1 - Item name
row 2 - size
row 3 - model code
row 4 - accessary

I want the report auto adjust when the value of row 3 and row 4 = null.

sample : if got 2 item
item 1 : need to display 4 row
row 1
row 2
row 3
row 4

item 2 : need to display 2 row only
row 1
row 2

anyone can help me ? thankx

To Export Crystal Report In Excel Format
Hello friends,

I made an application in vb 6 to generate crystal reports but i don't want to use export button of crystal report and want to add my code in vb which will automatically convert it into excel or pdf format. Also if possible it shld automatically send mail to my id without using outlook express....

waiting for responses,

Export A Crystal Report To PDF File Format Through VB
when i export a crystal report to PDF file format through VB i did not get a file PDF file format . but if i goto crystal report and from the preview i can export PDF file format. Can you guys pls give me a suggestion ,



Where Is My Decimal Point?
Dim Sec, Min, Hr As Long

Hr = Hr * 3600
Min = Min * 60
Sec = Sec + Min + Hr
Hr = Hr / 3600

Hr, Min and Sec are set to the current time. Hr in 24-hour. Why does it always finish with a whole number?

Where Is The Decimal Point?
I have a string "123456.798".

I need to know if it contains "." and if so, I need to know how many characters follow decimal.

I tried the InStr command but I must not understand it well enough because all I ever get is "0" from it.

Decimal Point
Hello everyone,

At the moment I'm working on a program and I've got a question: When I ask the program to print a number (vb:testpicture.print number) it uses an decimal komma. I would like it to use a decimal point. What settings do I need te change, or is there an format for this?
I thaught it's default setting was to use a point?

Hopefully someone can give me some response.


About Decimal Point....
I have a text box where the user enters a number. Specifically the number must be between 2,45 and 2,80. I control the keys pressed so that the user can only enter numbers, comma character and backspace ofcourse. I don't allow to press "."
But what happens when the user has set to his own PC as decimal point the "." ? How can I check this with code. Or what else can I do?

Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece

Retrieve .textrtf Format In The Dbase Using Crystal Report
how can i retrieve an information from .textRTF file from the dbase without displaying the code

tf1ansideff0deftab720{fonttbl{f0fswiss MS Sans Serif;}{f1fromanfcharset2 Symbol;}{f2froman Times New Roman;}}
deflang1033pardplainf2fs20 sample text

i only want to see the sample text in bold style...but whenever i retrieve that info from the server, it shows the code not the bolded can i do that?? anyone can help??

thanks in advance!!!


and what version of crystal report is best use in retrieving rtf file from the server....??

How To Import Crystal Report Into Pdf Format Using Visual Basic.
fellow experts,

i would like to import my crystal report into .pdf format using vb. Any ideas in that ? would like to hear from you.

Conversion From Crystal Report To Pdf File Format. ERROR~~~~
guys~plz help me with this. i'm trying to convert a crystal report to a pdf file format. but i got a "logon failed" error msg when i output it. plz tell me where is my error. a million thanks!

Is It Possible To Extract Data From Point A To Point B In A Report (txt File)

I have a report that some one has given me but the only section i want is half way down and never in the same place and the same size.

whats the best way to extract this section to a new file.

if anyone can supply some code i would appeciate it

Decimal Point No Round
I set a cell for values +/- 9.9 but I compute for this value 9.999999. Into the cell the value is the last value.
In my macro I wish to set in the cell a value as this


and, if it is possible, no rounds (4.6 -> 4.6 but not 5.0, if possible).
Any idea? Thanks in advance.


Checking For A Decimal Point
Could some one tell me how to check to see if a number has a decimal point in it, like 2.5? The number will be in a textbox1.Text. Thanks

Concatenate Decimal Point
I'm writing a program that uses an onscreen numeric keypad and I have used the following code on each of button to build the number on each key press.

Dim Number As Single

Number = Number & 1
TextBox1.Text = Number

Obviously 1 would change to 2 etc. depending on the button pressed.

My question is how do you then add a decimal point?

You can't just change Number = Number & . or Number = Number & "." because the variable is a Single.

Do I have to use a string and then convert back to a number?

Please tell me if I'm doing something really stupid, I am new at this.

Thanks in advance

Insert Decimal Point
I having a problem inserting a decimal number to the content of a recordset
I have the following code:

dim i as integer
i = parsed("Amount")
formatnumber(i, 2)

parsed("Amount") being the current record

if the content is 5695 i want it to print out as 56.95

instead its printing out as 5695.00

Please advice

thank you

Decimal Point Places
I know this probably sounds like a really stupid question but I've everything I know....which isnt much!!

I am doing some calculations involving currency in a program but when the calculation is completed the final sum textbox shows 3 decimal places after the point. How can I get it to round up or down to the nearest penny and just output to 2 decimal places?

I have set all my variables to be Currency and that didn't work so I tried Single and Double too.....that didn't work either

Limiting The Decimal Point To 1
I find that most code to limit the decimal point to one is written similar to this.

If KeyAscii = 46 And InStr(Text1, ".") > 0 Then
KeyAscii = 0
Exit Sub
Case 8, 48 To 57, 46 And InStr(TextBox, ".") = 0

The downside is that there must be a integer before the decimal point for it to function. Is there no way to limit the decimal point to one AND have the decimal point be the first digit entered? An example would be something less than 1 like .625

I have tried all that I know so far to no avail. Any ideas?


After Decimal Point Calculator
Hey im just wondering why i cant get any numbers AFTER a decimal point.

VB Code:
Dim t1 As IntegerDim t2 As IntegerDim t3 As IntegerDim ANS As Integert1 = Text1.Textt2 = Text2.Textt3 = Text3.TextANS = t1 * t2ANS = ANS + 11ANS = ANS / t3Text4.Text = ANS

Assume that i put "89" into TEXT1, "35" into TEXT2 and "9" into TEXT 3.

The answer SHOULD be "347.333333333" but using this code i only get "347" ... How come?

Allow Decimal Point Keypress?
Hey guys,

i'm using this code to only allow numeric kepresses however it won't let me type in a decimal point ".". How do i change this code to allow for that?


VB Code:
Private Sub txtfirst_KeyPress(KeyAscii As Integer) If IsNumeric(Chr(KeyAscii)) = False And KeyAscii <> 8 Then    KeyAscii = 0End If End Sub

Best Way To Remove Decimal Point ?
If I have a textbox and the value = 12.00 what is the best way to strip out the decimal so that it looks like 1200 ?

Thanks for any help.

Problem With Decimal Point ( , .)
I use some strings in a formula.
These strings can be "19.23" or "19,23".
I need the numbers to use in my formula.
I can use val() or Cdbl() but i have the problem
val(19.23) -> 19,23
val(19,23) -> 19
Cdbl(19.23) -> 1923
Cdbl(19,23) -> 19,23
With a . i have to use val() and with a , i have to use
Is there something that recognize both?


Decimal Point Fixing

I suppose this is easy enough if you know how but I don't have any help files

I need to set an output to a text box to two decimal places is there some sort
of format command?


Too Many Numbers After Decimal Point
Hi all

i've been having problems with my latest little proggy, im trying to create a simple (or so i thought) program to work out how many days a certain amount of power and money will last

the program is to help me out while i play starwars galaxies


if a factory uses 60 units of power per hour i want to know how many days a set amount of power will last

now i've managed to do all the math and the layout of my forms but when it comes to displaying the amount of days i have found a little problem

say the factory is set at 60 units of power per hour, thats 1440 units per day

now if i enter 60 in the rates box and 1440 in the amount of power and hit calculate button it tells me that it will last for 1 day

the program works well with certain numbers but if i put in the rate 60 and amount of power as 10000 i get a strange number


i've changed the text box to "number" and set its decimal places to 0 but it still gives me 6.94444444444444 as the total days

Option Explicit
Dim CPD As Long
Dim PPD As Long

Private Sub Command1_Click()
Call harvhandel
End Sub

Private Sub harvhandel()
If Combo1.Text = "Fusion Harvester" Then
CPD = MRATE.Text * 24
MDAYS.Text = CQTY.Text / CPD
Else: Call otherhandel
End If
End Sub

Private Sub otherhandel()
CPD = MRATE.Text * 24
PPD = PCR.Text * 24
PDAYS.Text = PQTY.Text / PPD
MDAYS.Text = CQTY.Text / CPD
End Sub

this is my calculation codeing, i've had to set up a sort of error handel because the fusion harvester doesnt require power

if any can see what i've done wrong or has sugguestions as to how i can stop the numbers from going beyond 0 decimal places please point them out ^_^

thanks in advance


Two Decimal Point And A ` Problems
hello everybody,

i have some question here is something regarding my project.
from the MSDN, i found something like this:


Dim myInt as Integer

Dim myStr as String = myInt.ToString("n")

i'm trying to use this statement but don't know how to use it.
actually i want to apply to my project because i have an average which give me a very unstable number at the end like:

2345.90001---->the .00001 is extract
23.8999999---->the actual value is 23.90

i want to make the decimal into two decimal that is *.00. how do i do that?

another question is how do we check for this sign ` ?


if value <> ` then-------->this give me error
'do this
'do that
end if

HOW do we determine this sign `?
i have try this :

if value <> "`" then
but it give me error too.


*Challenge* Rich Text Format In Crystal Report Viewer
I am actually writing my text data in the Rich Text Box of VB6. I have given buttons to do some formatting like 'Bold', 'Tab' etc. for the Rich Text Box data like MS WORD. The data is then saved in the Access Data Base in RTF format. When I retrieve the data from the Access data base to VB6, it is OK. But when I retrieve the same data in Crystal Reports 8.5, then CR is not able to interpret the data correctly. The text is OK but the formatting is disturbed.

Only One Decimal Point In Textbox, Using Keyascii
This is want I have at the moment.

Private Sub text1_keypress(keyascii As Integer)
Select Case keyascii
Case "8", "46", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "127"
Case Else
keyascii = 0
End Select
End Sub

But I only want a maximum of one decimal Point, how do I do this?

Optional Decimal Point Formatting
I have looked at previous posts and I don't see where anyone has asked this formatting question... I have several fields which may be an integer or a double, so I have the database set up to store the values as double, but when displayed I do NOT want to see a decimal if there is no fractional value.

That is, I have the following for formatting "#,###.##", so when you have "89" stored in the database it displays as "89." I don't want the decimal unless there are numeric values after the decimals.

Can this be done... easily?


Copyright 2005-08, All rights reserved