How to alter an update query

G

Guest

Hi
I have an update query which calculates the current age for cows. It is
DateDiff("m",[Date of Birth],Now()). However i want it so when another field
called Date of Movement has a date entered i want the current age field which
is automatically updated to have 0 automatically entered if there is
something in the date of movement field.
 
J

Jason Lepack

iif([Date of Movement] is null, DateDiff("m",[Date of Birth],Now()),
0)

Cheers,
Jason Lepack
 
T

Tom Lake

Thomas Woof said:
Hi
I have an update query which calculates the current age for cows. It is
DateDiff("m",[Date of Birth],Now()). However i want it so when another
field
called Date of Movement has a date entered i want the current age field
which
is automatically updated to have 0 automatically entered if there is
something in the date of movement field.

You're not storing the age of the cow in a table are you? That's a no-no.

Tom Lake
 

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