Auto fill later of 2 dates

  • Thread starter Thread starter oftenconfused
  • Start date Start date
O

oftenconfused

I have two fields...one contains the original date a project is due (Field
A), the other the new date the project is due (Field B).

I want to auto populate Field B with the later of Field A or today's date.

How I do this? It's more difficult to do than I imagined.

THANKS!
 
Often,

First of all, when you say "field", if you are referring to an actual
field in a table, I think this is inadvisable to store the date required
in a field in a table. This is derived data, so can be done whenever
you need it, in a calculated field in a query, or in the Control Source
of a calculated textbox on your form or report.

I think this expression will do it:
=IIf([Field A]>Date(),[Field A],Date())
 
Stev,

Thanks for your reply. When I referred to "field," I was referring to query
fields. I'm still a little confused. I used the "Build" feature to write
the expression you suggested below in "Criteria" (Under Field B), but it
doesn't seem to work. Should I be writing the expression someplace else?

Thanks!
Andrew




Steve Schapel said:
Often,

First of all, when you say "field", if you are referring to an actual
field in a table, I think this is inadvisable to store the date required
in a field in a table. This is derived data, so can be done whenever
you need it, in a calculated field in a query, or in the Control Source
of a calculated textbox on your form or report.

I think this expression will do it:
=IIf([Field A]>Date(),[Field A],Date())

--
Steve Schapel, Microsoft Access MVP
I have two fields...one contains the original date a project is due (Field
A), the other the new date the project is due (Field B).

I want to auto populate Field B with the later of Field A or today's date.

How I do this? It's more difficult to do than I imagined.

THANKS!
 
Andrew,

Sorry, the expression gave was intended for use in the Control Source of
an unbound textbox on your form.

To do it in a query, enter the same expression, but without the = sign
in front, into the Field row of a blank column in the query design grid.
 
Back
Top