lblHeading.Caption = "Projects Started between " & StartStg & " - " & EndStg
It would seem you logic is a bit off though. If the caption for this label is correct, the data you are trying to retrieve with the SQL statement would not return jobs that "started" within the date span, it would return jobs that started
and finished within the date span.
When dealing with starting and ending dates, you have to look at all the possibilities:
[ul][li]The job could start and end within the date span (completed within the date span)[/li]
[li]The job start date could fall in the date span and the end date is outside the span (job started, but not complete before the end date)[/li]
[li]The job finish date could fall in the date span and the start date is before the span (job finished but not started within the date span)[/li]
[li]The job could have started before the start date and ended after the end date (spanned more time than the date span is looking)[/li]
[li]The job started and finished before the start date[/li]
[li]The job started and finished after the end date[/li]
[/ul]
Bear in mind that you may need to look at multiple possibilities in order to retrieve the correct data.
Code:
SELECT JobID, JobName, StartDate, FinishDate
FROM TblJobDetails
WHERE StartDate between [date1] and [date2]
Would return those jobs that were "started" in the date span identified by date1 and date2
Mark
"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach