Solved

Crystal report question

Posted on 2000-02-28
22
303 Views
Last Modified: 2013-12-25
I use CR to print a report that show a range of records and the condition is that SomeDate is in arange of user given date range.
i'm usin CR shipping with VB5.
The way i'm using now is like this,
i'm using a query with CR without specifing the range in the CR design time, and at run time from VB code i add before using the CR.Activate
i add GroupSelectionFormula = something but i could not find how to correctly write the Formula using range of dates...

any one can help.

0
Comment
Question by:dyancer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
  • 2
  • +6
22 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 2565044
Use something like

CR.GroupSelectionFormula = "{Table.Date} >= Date (" & strStartYear & "," & strStartMonth & "," & strStartDay & ") and {Table.Date} <= Date (" & strEndYear & "," & strEndMonth & "," & strEndDay & ")"

Will give you a string such as
{Table.Date} >= Date (2000,01 ,01) and {Table.Date} <= Date (2000,02,29)
0
 
LVL 1

Expert Comment

by:lly
ID: 2565078
Hi dyancer,

Try adding some parameters into your query for your date range.  So that when you call CR, and assign the values for each parameters.  And hopefully it should work.

0
 
LVL 1

Author Comment

by:dyancer
ID: 2567745
To TimCottee ,
Indeed, the user input is a string formatted as a date, before activating the CR.activate i popup an input dialog where the user asked to input to date, name them FromDate,ToDate
the input is a string "1/1/2000" ,"3/1/2000"
so how to use these values in the example you show in your comment.

0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 43

Expert Comment

by:TimCottee
ID: 2567987
When your popup is closed, add this segment before the line I gave you before. It will convert the string date to a date field then chop up the date parts to use in the groupselectionformula line.

Dim dteDate As Date
Dim strStartDay As String
Dim strStartMonth As String
Dim strStartYear As String
Dim strEndDay As String
Dim strEndMonth As String
Dim strEndYear As String
dteDate = CDate(FromDate)
strStartDay = Day(dteDate)
strStartMonth = Month(dteDate)
strStartYear = Year(dteDate)
dteDate = CDate(ToDate)
strEndDay = Day(dteDate)
strEndMonth = Month(dteDate)
strEndYear = Year(dteDate)


0
 

Expert Comment

by:Drazen
ID: 2568246
Try with this!!

CR.GroupSelectionFormula = "{Table.Date} in Date("& Format(strStartDate, "yyyy,mm,dd") &")
to Date("& Format(strEndDate, "yyyy,mm,dd") &")"
 

0
 
LVL 1

Author Comment

by:dyancer
ID: 2577008
Drazen..
Sorry for the delay...
I'll check your answer and give u a feedback later , * i believe not before sunday..*

thanx
dyancer.
0
 

Expert Comment

by:mh_14
ID: 2578606
Hey Dyancer I'm exactly using dynamic range of date in my report.If all above suggestion doesn't work,let me know I will paste my code for you
Thanx
0
 
LVL 1

Author Comment

by:dyancer
ID: 2584502
Drozen,
Thank you for your code, I adopt your way though it's very limited because i need to enter specific Date coding either "mm,dd,yyyy" or any other variation the user can think of...
Now i do no longer get the message from CR telling "Formola error" but instead i get another runtime error saying "Unable to connect: Incorrect log parameters"
My Report based on a simple SQL with no input parameters...

Any Idea..?


0
 
LVL 1

Author Comment

by:dyancer
ID: 2584504
mh_14 ,
the question is open again...
i'll appreciate any help...

thanx in advance
0
 
LVL 1

Author Comment

by:dyancer
ID: 2594763

the question is open again...
0
 
LVL 1

Expert Comment

by:mathies
ID: 2753066
Use something like

CR.GroupSelectionFormula = "{Table.Date} >= Date (" & strStartYear & "," & strStartMonth & "," & strStartDay & ") and {Table.Date} <= Date (" & strEndYear & "," & strEndMonth & "," & strEndDay & ")"

Will give you a string such as
{Table.Date} >= Date (2000,01 ,01) and {Table.Date} <= Date (2000,02,29)
0
 
LVL 1

Author Comment

by:dyancer
ID: 2754332
Oppps,
i forget all about this question, I figured  out how to deal with the problem a month a go....

but, heres your points....
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 2754876
mathies, that is a precise copy of my original answer, please convert your answer to a comment or dyancer please reject this answer and choose a comment to accept as such.
0
 
LVL 1

Author Comment

by:dyancer
ID: 2755470
ok ppl,
I'm out for a vacation tell sunday,
in the meanwhile time you both should agree on one of you to get the points,


0
 
LVL 43

Expert Comment

by:TimCottee
ID: 2755599
Whilst I would like to have the points, they are not really at issue, the point is that it is against the EE guidelines to blatantly attempt to steal points in this manner. Should mathies not withdraw his/her answer within a reasonable time then I will refer this matter to customer services for resolution.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 2768818
I am posting a Q in the customer services section in order for the powers that be to bring this question to a resolution.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 2768833
0
 
LVL 5

Expert Comment

by:ianB
ID: 2769267
I am rejecting mathies answer to this question because it is a exact copy of TimCottee's answer.

Ian
Community Support @ Experts Exchange
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 200 total points
ID: 2787670
dyancer:

As there seems to be no response from you on this question I am proposing my original solution and additional comments as an answer.
0
 

Expert Comment

by:ananddarshan
ID: 2879989
Which Database are you using?
0
 
LVL 3

Expert Comment

by:darinw
ID: 3683792
Answer accepted
0
 
LVL 3

Expert Comment

by:darinw
ID: 3683794
Accepting the proposed answer and moving question to PAQ for the missing dyancer.

darinw
Customer Service
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Saving history changes to sub form 4 52
Run code from text file in vb 1 87
Copy a row 12 70
using web browser with BING 40 137
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

696 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