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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display all records within 24 hrs or a specified time

Status
Not open for further replies.

DianaStewart

Programmer
Apr 16, 2002
58
CA
I have a date and time field. I want to be able to display all the records where the date time field is before a specified time for example 3h00 am in the morning. It would be nice also if I could take the weekends into consideration as well. Example, if the day is monday then display all the records from last Friday only...

Help appreciated
 
Create a parameter date time, and then put the following formula in your record selection:

If DayofWeek({?DateTime})=2 then {Datefield} in {?DateTime} to Dateadd("d",-3.{?DateTime}) else {Datefield} in {?DateTime} to Dateadd("d",-1.{?DateTime})


Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
If I open my report and todays date is Tuesday how can I display all the records from the previous day starting at 3h00 am in the morning. So in other words all the records entered in by Monday at 3h00 am in the morning will be displayed up to Tuesday...
 
If you already have a datetime parameter, then the time you specify will already take care of this for you. Without a datetime parameter, if you want to get all data from 3am on the last business day, then you'd amend the formula dgillz has already given you like:

If DayofWeek({?Date})=2 then {Datefield} in {?Date} to Dateadd("d",-3,DateTime(CDate({?Date}),CTime("03:00"))) else {Datefield} in {?DateTime} to Dateadd("d",-1,DateTime(CDate({?Date}),CTime("03:00")))

Naith


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top