Solved

Problem with Date format in crystal report

Posted on 1998-07-15
3
181 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
Comment Utility
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
Comment Utility
biko,
I have tried your code
RUNSHEET_HISTORY.RUN_DATE
 & it doesn't work for me!
0
 

Expert Comment

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

 & it doesn't work for me!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

743 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

12 Experts available now in Live!

Get 1:1 Help Now