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

Date Time 1

Status
Not open for further replies.

rsunra

IS-IT--Management
Sep 30, 2003
53
AU
G'day all

I have two questions the first is how can I take the date and time and combine them in the report. The date is in a field call Event_Date and in the format 6/10/03 00:00:00 and the Time is in Event_Time in a format of 01/01/1900 06:30:57 and I want to get a new Timedate field of 6/10/03 06:30:57.

2nd Questions. How do I write a query for the new field the will get all records currentday -1 for the last 24 hours. I want to be able to run these report automatically
 
For Crystal 8.5, you can write a formual field that would combine date and time. Something like
Totext ({Event_Date}, "dd/MM/ccyy") & " " &
Totext ({Event_Time}, "HH:mm:ss")

For the last 24 hours, try
CurrentDateTime-1
If this fails, try
DateAdd("h", -24, CurrentDateTime)

Madawc Williams
East Anglia, Great Britain
 
Ok

datetime (Totext ({Main.Event_Date}, "dd/MMM/yy") & " " & Totext ({Main.Event_Time}, "HH:mm:ss"))

Worked!!!

Now the question is...

I run a report at 9AM and I want the report to include all records for Yesterday at 6AM to today at 6AM Any Ideas.

 
Hi !

Try this in your Record Selection:

(
{YourDateTimeField} > DateTime(Year(CurrentDate),Month(CurrentDate),Day(CurrentDate),06,00,00)-1
and
{YourDateTimeField} <= DateTime(Year(CurrentDate),Month(CurrentDate),Day(CurrentDate),06,00,00)
)

/Göran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top