Calculation in Form only works some of the time?

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!
 
A

Allen Browne

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())
 
S

Suthee

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!
 

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