function quer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a below function in a text field in a report design

=IIf([test]>3,[datecompleted]-[daterecd],"UNDER 3 DAYS")

when report pulled out it , all records is seen along with under 3days

Is it possible to take out the records which are under 3 days

Many Thanks
 
If you do not yet have a query as the RecordSource of your report, create a
query, and type this into the Field row:
DateDiff("d", [daterecd], [datecompleted])
Now in the Criteria row under this field, enter:

The report will show only those records where there are 3 or more days.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Gerald said:
I have a below function in a text field in a report design

=IIf([test]>3,[datecompleted]-[daterecd],"UNDER 3 DAYS")

when report pulled out it , all records is seen along with under 3days

Is it possible to take out the records which are under 3 days

Many Thanks
 
Calculating dates is not quite as direct as calculating numbers. If
[datecompleted] and [daterecd] are date fields, DateDiff should do what you
need:

=IIf([test]>=3,DateDiff("d",[datecompleted],[daterecd]),"UNDER 3 DAYS")

Using >= (greater than or equal to) is my suggestion, since without it a 3
day interval will be reported as UNDER 3 DAYS.
 
I have a query, though need to know under which field row I should be entering
DateDiff("d", [daterecd], [datecompleted])

report pulled out is from a query which has daterecd],& [datecompleted

Please advise

Thanks
Allen Browne said:
If you do not yet have a query as the RecordSource of your report, create a
query, and type this into the Field row:
DateDiff("d", [daterecd], [datecompleted])
Now in the Criteria row under this field, enter:

The report will show only those records where there are 3 or more days.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Gerald said:
I have a below function in a text field in a report design

=IIf([test]>3,[datecompleted]-[daterecd],"UNDER 3 DAYS")

when report pulled out it , all records is seen along with under 3days

Is it possible to take out the records which are under 3 days

Many Thanks
 
Type the expression into the Field row in query design, in a fresh column.

Put the criteria in the Criteria row under the same column.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Gerald said:
I have a query, though need to know under which field row I should be
entering
DateDiff("d", [daterecd], [datecompleted])

report pulled out is from a query which has daterecd],& [datecompleted

Please advise

Thanks
Allen Browne said:
If you do not yet have a query as the RecordSource of your report, create
a
query, and type this into the Field row:
DateDiff("d", [daterecd], [datecompleted])
Now in the Criteria row under this field, enter:

The report will show only those records where there are 3 or more days.

Gerald said:
I have a below function in a text field in a report design

=IIf([test]>3,[datecompleted]-[daterecd],"UNDER 3 DAYS")

when report pulled out it , all records is seen along with under 3days

Is it possible to take out the records which are under 3 days

Many Thanks
 
Back
Top