Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Record Selection Question Post Reply Post New Topic
Author Message
mvaughn
Newbie
Newbie
Avatar

Joined: 09 Oct 2007
Location: United States
Online Status: Offline
Posts: 16
Quote mvaughn Replybullet Topic: Record Selection Question
    Posted: 08 Sep 2009 at 8:07am
Ok have used the record selection formulas plenty but now I have an issue I can seem to get.  Fiscal Year runs from 11/1 to 10/31.  Trying the following to gets records through  the end of the month and year selected as parameters when teh report is called from a VB app.  If I remove all but the plant parameter and one datepart line of code, report works fine.  All 3 lines of the datepart code return values when the are the only month/year criteria.  When I try 2 combos or all 3 the report is blank.  I have tried or after the datepart lines.  Have also tried placing the plant = plant lline with each group. Any ideas?
 
 
if {?Month} < 11 then
{SalesDetailTable.Plant} = {?Plant} and
datepart("m",{SalesDetailTable.Rundate}) <= {?Month}and datepart("yyyy",{SalesDetailTable.Rundate}) = {?Year} and
datepart("m",{SalesDetailTable.Rundate}) = 11 and datepart("yyyy",{SalesDetailTable.Rundate}) = ({?Year}-1) and
datepart("m",{SalesDetailTable.Rundate}) = 12 and datepart("yyyy",{SalesDetailTable.Rundate}) = ({?Year}-1)
IP IP Logged
mvaughn
Newbie
Newbie
Avatar

Joined: 09 Oct 2007
Location: United States
Online Status: Offline
Posts: 16
Quote mvaughn Replybullet Posted: 09 Sep 2009 at 1:41pm
I got it working by building a table on the vb side that uses a sql statement containing my parameters.  Only parameter the report uses now is plant and is connected to the table built in the vb app.
IP IP Logged
BernieHunt
Newbie
Newbie


Joined: 03 Apr 2007
Location: United States
Online Status: Offline
Posts: 21
Quote BernieHunt Replybullet Posted: 17 Sep 2009 at 12:31pm
My experience has been that if I'm feeding Crystal from VB, the more record prep I can do in VB the faster my code runs. I try to just let Crystal do the formating and I'll do the querys in VB.
 
Bernie
 
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.