T
Tom via AccessMonster.com
I have a query that I recieved alot of help with from this discussion board.
It works great, and Im greatfull for the help I got. The problem now is that
if the field its using is empty it expression will not work. Can anyone help
me change it so it will deal with null fields correctlly?
This is what the query looks like:
LetterOrVisitThisyear: IIf((DateDiff("yyyy",Date(),[LastVisitDate]) Mod 3)=0,
"Visit","Letter")
It checks the LastVisitDate field against the current date to see if it has
been three years since the last visit, if it hasn't then it tells the user to
send a letter, if it has then it tells the user to visit the site.
What I need is to add to it so that it deals with no entry in the
LastVisitDate field. If the LastVisitDate field is null then it should use
the lowest, (oldest date), record in the [DateSent] field out of the all the
records in the table that deal with that particular business. (Im not sure
how to isolate just the records with one business, eash business has several
[DateSent] records in the business table)
The problem is that the way it is now, if the [LastVisitDate] field in empty
then it only returns "Letter". I need it to return letter for the first two
years and then return "Visit" on the third year just as it would if the field
were not empty. The [DateSent] field will always have a entry.
Sorry its so hard for me to explain, thanks for helping.
Tom
It works great, and Im greatfull for the help I got. The problem now is that
if the field its using is empty it expression will not work. Can anyone help
me change it so it will deal with null fields correctlly?
This is what the query looks like:
LetterOrVisitThisyear: IIf((DateDiff("yyyy",Date(),[LastVisitDate]) Mod 3)=0,
"Visit","Letter")
It checks the LastVisitDate field against the current date to see if it has
been three years since the last visit, if it hasn't then it tells the user to
send a letter, if it has then it tells the user to visit the site.
What I need is to add to it so that it deals with no entry in the
LastVisitDate field. If the LastVisitDate field is null then it should use
the lowest, (oldest date), record in the [DateSent] field out of the all the
records in the table that deal with that particular business. (Im not sure
how to isolate just the records with one business, eash business has several
[DateSent] records in the business table)
The problem is that the way it is now, if the [LastVisitDate] field in empty
then it only returns "Letter". I need it to return letter for the first two
years and then return "Visit" on the third year just as it would if the field
were not empty. The [DateSent] field will always have a entry.
Sorry its so hard for me to explain, thanks for helping.
Tom