IIf statements - help me!!!

P

Pixienix

I'm not very familiar with IIf statements and need to ask Access to do the
following:

If the question "follow up required" is answered "yes", then add 14 days to
the "Registration date" to give the follow up due date.

Any suggestions would be gratefully accepted! I'm not really up on the whole
Null stuff so simple answers would be best!

Cheers
 
W

Wayne-I-M

Hi

It depend on where you are doing this (form/query ?) and how you are saying
"yes". Are you using a tick box or are you using the text "yes"

In a query (if using a tick box)
Create a calculated column like this.

FollowUp: IIf([TbleName]![follow up
required]=-1,DateAdd("d",+14,[TableName]![due date]))

In a query (if using text "yes")
Create a calculated column like this.

FollowUp: IIf([TbleName]![follow up
required]="yes",DateAdd("d",+14,[TableName]![due date]))

You will need to change the TableName and the field names [follow up req]
and [due date] to what they really are.

In a form do soemthing simaler but use = instead of FollowUp:

If you have problems with this post back and someone will help
 
B

BruceM

Note that Wayne's suggestion does not store the calculation result, which is
as it should be if you always need the same 14 days. However, if you need
flexibility to change the due date (to allow for holidays, for instance) you
will probably need to store the value in its own field. One of Wayne's
expressions could be used for that, maybe in the After Update event of the
[FollowUpRequired] control, but flexibility may not be needed, so the
details can wait.
 
W

Wayne-I-M

Hi Pixienix

To follow on from Bruce's post please note the answer I gave will not work
in vba AfterUpdate. If you need this, post back and someone will give you
the
If me.???? then etc etc

Better still if you can give full details (names etc) you will get a full
answer

HTH

--
Wayne
Manchester, England.



BruceM said:
Note that Wayne's suggestion does not store the calculation result, which is
as it should be if you always need the same 14 days. However, if you need
flexibility to change the due date (to allow for holidays, for instance) you
will probably need to store the value in its own field. One of Wayne's
expressions could be used for that, maybe in the After Update event of the
[FollowUpRequired] control, but flexibility may not be needed, so the
details can wait.

Pixienix said:
I'm not very familiar with IIf statements and need to ask Access to do the
following:

If the question "follow up required" is answered "yes", then add 14 days
to
the "Registration date" to give the follow up due date.

Any suggestions would be gratefully accepted! I'm not really up on the
whole
Null stuff so simple answers would be best!

Cheers
 
Top