Showing elapsed days in a field

G

Guest

I currently have a field in a form (and the table it is based on) showing the
age of certain accounts. Currently, it is a static field, but now the
project has expanded into constant surveillance and so I need to now track
the age from create date through present.

I found dateDiff in a query, but it doesn't seem to fit my bill exactly
since each account may have a different creat date.

My question is, should I change the existing field "Age" to read "create
date" then run a query off of it and use datediff and use **/**/**** to
represent the create date in the query?
 
G

Guest

Hi dvorasnell,

Use an unbound field on your form with the control source similar to this:

=iif(isnull([CreateDate]), "No Create Date", datediff("d", [CreateDate],
date()))

Hope this helps.

Damian.
 
G

Guest

Does the "age" field need to be unbound? Or may it be attached to my table?

Damian S said:
Hi dvorasnell,

Use an unbound field on your form with the control source similar to this:

=iif(isnull([CreateDate]), "No Create Date", datediff("d", [CreateDate],
date()))

Hope this helps.

Damian.

dvorasnell said:
I currently have a field in a form (and the table it is based on) showing the
age of certain accounts. Currently, it is a static field, but now the
project has expanded into constant surveillance and so I need to now track
the age from create date through present.

I found dateDiff in a query, but it doesn't seem to fit my bill exactly
since each account may have a different creat date.

My question is, should I change the existing field "Age" to read "create
date" then run a query off of it and use datediff and use **/**/**** to
represent the create date in the query?
 
F

fredg

I currently have a field in a form (and the table it is based on) showing the
age of certain accounts. Currently, it is a static field, but now the
project has expanded into constant surveillance and so I need to now track
the age from create date through present.

I found dateDiff in a query, but it doesn't seem to fit my bill exactly
since each account may have a different creat date.

My question is, should I change the existing field "Age" to read "create
date" then run a query off of it and use datediff

Are you trying to determine how many days have elapsed since
[CreateDate]?
Yes. In an unbound control on your form:
=DateDiff("d",[CreateDate],Date())

and use **/**/**** to
represent the create date in the query?

No. DateDiff will return the number of days difference between two
dates. It does not return a date, so you shouldn't format it as a
date.

If you are trying to get a date that is, for example, 90 days from the
create date, then you would want to use DateAdd():
=DateAdd("d",90,[CreateDate])
Now you have a date which can be formatted as a date.
 
G

Guest

You want an unbound field, as you (generally) never want to store something
that you can calculate...

D.

dvorasnell said:
Does the "age" field need to be unbound? Or may it be attached to my table?

Damian S said:
Hi dvorasnell,

Use an unbound field on your form with the control source similar to this:

=iif(isnull([CreateDate]), "No Create Date", datediff("d", [CreateDate],
date()))

Hope this helps.

Damian.

dvorasnell said:
I currently have a field in a form (and the table it is based on) showing the
age of certain accounts. Currently, it is a static field, but now the
project has expanded into constant surveillance and so I need to now track
the age from create date through present.

I found dateDiff in a query, but it doesn't seem to fit my bill exactly
since each account may have a different creat date.

My question is, should I change the existing field "Age" to read "create
date" then run a query off of it and use datediff and use **/**/**** to
represent the create date in the query?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top