Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formulae in Selection Criteria

Status
Not open for further replies.

keijen

Programmer
Jul 12, 2001
16
AU
Learner having problem using a formula in a recordset selection:

I have a (Basic) formula to set an onschedule flag:
Dim OnSchedule as String
OnSchedule = "1"
'now check out actual project, to set
If {ProjStatus.ProjStatDesc} <> &quot;Completed&quot; Then
OnSchedule = &quot;1&quot;
Else
If {Initiatives.Project_enddate} > CurrentDate Then
if DateValue({Milestone.Initial_End}) <= CurrentDate Then
OnSchedule = &quot;0&quot;
End If
If DateValue({Milestone.Actual_start}) > DateValue({Milestone.Initial_start}) Then
OnSchedule= &quot;0&quot;
End If
End If
End If
formula = OnSchedule

I have this as the selection formula ( using Selection Expert) to show all Not On Schedule items:
{@onSchedule}= &quot;0&quot;

The formula item is placed in a Group header on the report.

But I get no records returned, altho' there many dozens that qualify.

Any clues to using formulae in selection please.

TIA
 
Why is it in the group header? There's no group data in the formula.
Put it in the detail section so it is processed per record, just as the selection formula will.
If that doesn't work, remove it from the selection formula and just examine the value of the formula in the report to see if the formula is wrong. Andrew Baines
Chase International
 
your default value of OnSchedule is &quot;1&quot;

I find this awkward
***************************************
Else
If {Initiatives.Project_enddate} > CurrentDate Then
if DateValue({Milestone.Initial_End}) <= CurrentDate Then
OnSchedule = &quot;0&quot;
End If
If DateValue({Milestone.Actual_start}) > DateValue({Milestone.Initial_start}) Then
OnSchedule= &quot;0&quot;
End If
End If
***************************************

this could be written

Else
If ({Initiatives.Project_enddate} > CurrentDate and
DateValue({Milestone.Initial_End}) <= CurrentDate)
OR
DateValue({Milestone.Actual_start}) >
DateValue({Milestone.Initial_start}) Then
OnSchedule= &quot;0&quot;
End If

is something falling through the cracks


Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top