Update Time Field

  • Thread starter Thread starter Arturo
  • Start date Start date
A

Arturo

I have a field named ReportTime. I need a query that will update this field
to Time() - 3 minutes if it is more than three minutes old. How do I do that?

Thank you.
 
Assuming that report time is a dateTime value.

IIF(DateAdd("s",180,ReportTime)<Time,Time,ReportTime)

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Thanks. What I need is an update query that will make ReportTime equal to
Time() - 3 minutes if ReportTime is older than 3 minutes.

KARL DEWEY said:
Try this --
IIF([ReportTime]<= Time()-3, Time(), [ReportTime])
--
Build a little, test a little.


Arturo said:
I have a field named ReportTime. I need a query that will update this field
to Time() - 3 minutes if it is more than three minutes old. How do I do that?

Thank you.
 
What I mean is what would I put in the criteria and what would I put in the
Update To block?

John Spencer said:
Assuming that report time is a dateTime value.

IIF(DateAdd("s",180,ReportTime)<Time,Time,ReportTime)

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

KARL said:
Try this --
IIF([ReportTime]<= Time()-3, Time(), [ReportTime])
 
If using the query builder then

Criteria field: [ReportTime]
Criteria block: <= Time()-3
Update Block: Time

Arturo said:
What I mean is what would I put in the criteria and what would I put in the
Update To block?

John Spencer said:
Assuming that report time is a dateTime value.

IIF(DateAdd("s",180,ReportTime)<Time,Time,ReportTime)

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

KARL said:
Try this --
IIF([ReportTime]<= Time()-3, Time(), [ReportTime])
 
make ReportTime equal to Time() - 3 minutes if ReportTime is older than 3
minutes.
You do realize that it will be wrong again within ONE SECOND!

Update To -- DateAdd("s",-180,Time())
Criteria -- <=DateAdd("s",-180,Time())

--
Build a little, test a little.


Arturo said:
Thanks. What I need is an update query that will make ReportTime equal to
Time() - 3 minutes if ReportTime is older than 3 minutes.

KARL DEWEY said:
Try this --
IIF([ReportTime]<= Time()-3, Time(), [ReportTime])
--
Build a little, test a little.


Arturo said:
I have a field named ReportTime. I need a query that will update this field
to Time() - 3 minutes if it is more than three minutes old. How do I do that?

Thank you.
 
I used Karl Dewey's solution and it worked. Thanks.

KARL DEWEY said:
minutes.
You do realize that it will be wrong again within ONE SECOND!

Update To -- DateAdd("s",-180,Time())
Criteria -- <=DateAdd("s",-180,Time())

--
Build a little, test a little.


Arturo said:
Thanks. What I need is an update query that will make ReportTime equal to
Time() - 3 minutes if ReportTime is older than 3 minutes.

KARL DEWEY said:
Try this --
IIF([ReportTime]<= Time()-3, Time(), [ReportTime])
--
Build a little, test a little.


:

I have a field named ReportTime. I need a query that will update this field
to Time() - 3 minutes if it is more than three minutes old. How do I do that?

Thank you.
 
Back
Top