Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Problem with Date format in crystal report

Posted on 1998-07-15
3
Medium Priority
?
191 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 200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

916 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