SQL Statment with Date change...

Villarreal68

Registered User.
Local time
Yesterday, 22:50
Joined
Feb 15, 2007
Messages
133
Hello everyone,

I'm working on an SQL Statment that has a month and year request, but I want to change it to request a date range.

The statment is as follows:

Code:
[COLOR=red]PARAMETERS [Enter Month] Integer, [Enter Year] Integer;[/COLOR]
SELECT     vWorkOrders.StatusCode AS Status, vWorkOrders.StatusDescription, vWorkOrders.SubStatusDescription, vWorkOrders.statusdate,
  vWorkOrders.WONumber, vWorkOrders.WODescription AS Description, vWorkOrders.DateCreated AS [Due Date], vWorkOrders.AssetxAssetNumber AS Asset, vWorkOrders.AccountCode AS Account, 
                      vWorkOrders.AccountDescription, vWorkOrders.CompleteDate, vCompanyData.MailName, vWorkOrders.WONumber AS CountWO, vWorkOrders.TypeCode,
  vWorkOrders.skillcode
FROM         vWorkOrders LEFT OUTER JOIN
                      vCompanyData ON vWorkOrders.IDSegment = vCompanyData.IDSegment
[COLOR=red]WHERE   month(datecreated) = [Enter Month][/COLOR]
[COLOR=red]AND year(datecreated) = [Enter Year][/COLOR]
AND (vWorkOrders.TypeCode) = 'CM'
AND vworkorders.statuscode in ('CMPLT','CLOSE','ACTIV')

I would like to change what is highlighted in Red from asking for a Month and Year to ask for a date Range like BETWEEN [Begin Date] And [End Date].

How can it be acomplish? I've tried many things but nothing seems to work.
BTW this is attached to a report.

Any help is greatly appreciated.

Thanks!
 
Why don't you post your effort and we'll fix it. You've already got it, from the looks of it.
 
Hello Paul,

Thanks for replying. Well it looks like it's working (partially).

This is what it is: There is a report built on C1ReportDesigner tapping into an SQLExpress database that needed to be modified to meet some new needs. I have never used C1ReportDesigner, so I was trying to apply what I've learned on Access to the code on this Report utility.

And from the looks of it, what I changed on it was working all along, but there is a graph that works on the old code, but not on the new code. I'm not familiar with C1ReportDesigner and been tinkering with it since yesterday. But it looks like the changes I made are working fine (on the query part of the report), but the graph (for some odd reason) does not want to display the results. So I think it's another part of the coding relating to the Report part of the C1ReportDesigner that is the issue.

I'll keep hacking at it and I'll propbably get something out of it (at least a headacke :) ).

So the SQL code part of it is working it's just something related to the C1ReportingDesigner code in relation to the Report Graph that is failing.

Thanks for your reply thoug.

René
 
Sorry, I have no experience with C1ReportDesigner either.
 

Users who are viewing this thread

Back
Top Bottom