Calculation in Form only works some of the time?

  • Thread starter Thread starter Suthee
  • Start date Start date
S

Suthee

Hi,

I have a form that make a date calculation based on a "PURCH_DATE" field. I
have a text box with the following formula plugged into it: DateDiff( 'y',
[PURCH_DATE], Date()) Now this works only some of the time. When it
works, it properly displays how old a particular invoice is. If I switch
over to design view, and then back the text box displays "Name?#". The only
way I can get it working again is to close the database and reopen it again,
and once again it works. Does anyone know what is going on? Thanks!
 
If you are trying to get a date difference in whole years, try:
=DateDiff("yyyy", [PURCH_DATE], Date())

If you wanted a difference in days, try:
=DateDiff("d", [PURCH_DATE], Date())
 
Thanks for the reply. I ended up deleting the form, and creating a new one.
For some reason this solved the problem, and I didn't edit the formula at
all. Kinda strange though.


Allen Browne said:
If you are trying to get a date difference in whole years, try:
=DateDiff("yyyy", [PURCH_DATE], Date())

If you wanted a difference in days, try:
=DateDiff("d", [PURCH_DATE], Date())

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Suthee said:
I have a form that make a date calculation based on a "PURCH_DATE"
field.
I
have a text box with the following formula plugged into it: DateDiff( 'y',
[PURCH_DATE], Date()) Now this works only some of the time. When it
works, it properly displays how old a particular invoice is. If I switch
over to design view, and then back the text box displays "Name?#". The only
way I can get it working again is to close the database and reopen it again,
and once again it works. Does anyone know what is going on? Thanks!
 
Back
Top