Solved

Problem with Date format in crystal report

Posted on 1998-07-15
3
182 Views
Last Modified: 2010-08-05
Dear sir,
Now, I use Microsoft Access 95 as my database and Visual Basic 4.0. After I finished my crystal report. I try to select group of record with SelectionFormula . But I can't get any report after I try to send in a date format. How can I solve this problem? I have tried for several ways which I know but it's not work..

Such as;

crystalreport1.selectionformula = "{tblrpt.somedate} = #" & format(maskedbox1.text, "mm/dd/yy") & "#"

or

crystalreport1.selectionformula = "{tblrpt.somedate} = #" & cvdate(maskedbox1.text) & "#"

or

crystalreport1.selectionformula = "{tblrpt.somedate} = " & cvdate(maskedbox1.text)

PS. I format my date as short date format.
0
Comment
Question by:Mcblake
  • 2
3 Comments
 

Accepted Solution

by:
biko071598 earned 50 total points
ID: 1465834
CRW uses a different date specifier.  Make sure your reports have "Convert Date-Time to Date" checked in options and use the following syntax.

crystalreport1.selectionformula = "{tblrpt.somedate} = date(1998,05,02)"

date has a parm format of date(yyyy,mm,dd).

 

instead of this:
"crystalreport1.selectionformula = "{tblrpt.somedate} = #" & format(maskedbox1.text, "mm/dd/yy") & "#" "


There are little issues selecting dates in CRW.  It is almost always better to specifiy a date range rather than a single date.
i.e. instead of  {some.date} = date(1997,1,1) use {some.date} >= date(1997,1,1) and {some.date} < (1997,1,2)

Good Luck

0
 

Expert Comment

by:Jules_Madgwick
ID: 5018604
biko,
I have tried your code
RUNSHEET_HISTORY.RUN_DATE
 & it doesn't work for me!
0
 

Expert Comment

by:Jules_Madgwick
ID: 5018619
biko,
I have tried your code
crystalreport1.selectionformula = "{tblrpt.somedate} = date(1998,05,02)"

 & it doesn't work for me!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to create a duplicate finder Application 9 113
Reading the Contents of a Directory In Access VBA 5 58
Determine Range to Select 5 42
Problem to With line 4 37
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now