Short Date in Formula Field

Visual Basic


  • 1. Global Text Editing In A Report
    I have created a series of reports that were made with large amounts of text that came from a Word document produced by one of my customers. Unfortunately, I didn't check the Word document too carefully, and there are a lot of extra spaces in the middle of sentences. (This of course plays havoc with trying to justify lines of text.) Is there any way that I can go through and edit this text once I have placed it in Crystal Reports on a global basis? Or do I have to edit each and every text block separately? Thanks Martin
  • 2. Chart Labels Overlapping
    I have a pie chart that I have put into my report. I have the slices labeled with the values on the slices and the labels for the slices outside of the slices. Because some of the slices are really small, the labels and/or values sometimes overlap each other. Is there any way to prevent this from happening? I have tried adjusting the size / rotation / position of the chart, but I cannot get them to be 100% correct. Thanks in advance. Martin
  • 3. Sub Reports?
    Hello, I have a crystal report that needs to display two tables worth of data. Table1 and Table2. Table1 is at the top of the crystal report and Table2 is at the bottom. Using VS 2003, I was able to place Table1 in the details section and create a sub report in the report footer section for Table2. The problem I am having is that I do not want the report to be clickable. I just want the data to be shown on the single report. (Table1) Stuff Stuff Stuff Sub Total: Stuff (Table2) Stuff Stuff Stuff Sub Total: Stuff Am I doing this wrong? Is there a better way to accomplish this? How would I make the subreport not open to the next report when it is clicked? Any assistance will be greatly appreciated. Thanks, Chuck
  • 4. [.NET] Setting up color and font of a parameter field.
    Hi all, I have a CR report and within there is a parameter field string type. Now, from VB NET code, at run time, I can set the value of the field and that's ok but how I can set also, from code at run time, the color of the text? And the font? Thank you, Luca.
  • 5. 3rd Party Crystal Report viewers
    Hello, Does anyone have any experience with 3rd Party Crystal Report viewers? I'm looking for a viewer that allows me to view reports in our web app without having crystal reports installed on the app server. Does such a thing exist? I also need the rpt files to be independant of saved data and db connection info. Thanks in advance. JS

Short Date in Formula Field

Postby Wayne Wengert » Thu, 09 Dec 2004 10:01:17 GMT

I am using CR10 in a .NET windows app and I have a formula field as shown

{Print.ShowName} & " - " & {Print.Date}

I want the date portion  as a short date (e.g. mm/dd/yy) but it is coming
out as "Sunday, December 5, 2004"

How can I convert that to a short date? I don't see any functions to do it?


Re: Short Date in Formula Field

Postby Bob Holmes » Thu, 09 Dec 2004 22:41:21 GMT

Hi Wayne,
    I couldn't find a way to format it in "Short" format within a formula
field, but I did find that in "File | Options", on the "Fields" tab, choose
"Date..." and then the "Date" tab.  You can change the style to "System
Default Short Format".  I hope this helps.


Re: Short Date in Formula Field

Postby Rob Diamant » Thu, 09 Dec 2004 23:13:26 GMT

Wayne try this:


Re: Short Date in Formula Field

Postby Wayne Wengert » Fri, 10 Dec 2004 02:58:37 GMT

Thanks guys.



Similar Threads:

1.formating a date field inside of a "Formula Field"

I have created a formula field which prints brackets around a date if the 
date is a required date in my report  (eg  [  1/6/2005  ] ).  However, I 
want to format the date in mm/dd/yyyy format.  (eg  [  01/06/2005  ] ).  the 
formula is as follows:

if {ReqdCourses.Cmp1date} > #01/01/1901# then "[  " & {ReqdCourses.Cmp1date} 
& "  ]" else "      "

any thoughts?


Bill V 

2.changing short date time setting mangles the date seperator


I have the following code in my app - it is supposed to change the short
date format style to dd/mm/yyyy
it does this unfortunately it also mangles the date seperator changing it
from / to /mm/ any ideas why this is happwning ?

this happens on win98 and is ok on win2k and xp


Public Declare Function GetSystemDefaultLCID _
        Lib "kernel32" () As Long

Public Declare Function SetLocaleInfo Lib _
     "kernel32" Alias "SetLocaleInfoA" ( _
     ByVal Locale As Long, _
     ByVal LCType As Long, _
     ByVal lpLCData As String) As Boolean

Public Function locale_change()
    On Error Resume Next
    Dim lngLocale As Long
    lngLocale = GetSystemDefaultLCID()
    Call SetLocaleInfo(lngLocale, LOCALE_SSHORTDATE, "dd/mm/yyyy")
End Function

3.Error with formula fields- the remaining text does not appear to be part of the formula


i want to fill some formula fields.
I added my formula fields in the report with -> unbound fields, string. In
my report it is named [@UnboundString1].
So i tried to fill these fields with:

Dim crReport As New CrystalReport1

crReport.DataDefinition.FormulaFields.Item("UnboundString1").Text = "a"

Me.CrystalReportViewer.ReportSource = crReport

When i try to run this, i get these error message :

the remaining text does not appear to be part of the formula .... ?

I tried to set the text to a number like 1, this works !
So what is my fault ???

Kind regards,


4.Using Formula Field Names within a formula

Anyone ever try to use part of the Formula Field name within the formula?

For example:
Formula Field "Day01"

if day({table.entrydate}) = val(right(formulaname,2)) then

I know I can hard code the formulas, but I have 10 sets of formulas to build 
and I am feeling really lazy.


5.Returning a short date in a datareader

I have the following however the date is returned in the long format. I want 
to display as dd/mm/yyyy.

            If Not drReader.Item("offerstatusdate") Is DBNull.Value Then
                txtOfferStatusDate.Text = drReader.Item("offerstatusdate")
            End If

6. How to Get Short Date Format Pattern?

7. Short Date Format

8. Retrieving short system date format in VBA

Return to Visual Basic


Who is online

Users browsing this forum: No registered users and 18 guest