add 10 days to current date

  • Thread starter Thread starter Jimbo
  • Start date Start date
J

Jimbo

I've struggled with the correct subject line as it is, so I'll have a tough
time explaining what I need. I have a form with two fields
Last Visit
Next Visit
I'm entering the last visit date in using a calendar entry that works fine.
I would like to code an event that will automatically add 10 days to that
date and place it in the Next Visit field and use some sort of condition
formatting so that when that date approaches within a 3 or 4 day time frame
it turns to red text or something. I hope I made myself clear.

Thanks in advance,

Troy
 
try the following code in the AfterUpdate event procedure of the Last Visit
control, as

Me![Next Visit] = DateAdd("d", 10, Me![Last Visit])

note that you're going to get a ten day "hop", period, even if that means
the next visit date is a weekend or a holiday.

as for conditional formatting, if you're using A2000 or newer, open your
form in design view, select the NextVisitDate control, and on the menu bar
click Format, Conditional Formatting, and select Field Value Is, "greater
than", and add the expression

DateAdd("d", -5, [Next Visit])

hth
 
Why do you need the next Vist date. You could have a Query do it for you.

Days past:Date() - [Last Visit]
Criteria >6

This will give you all the records that are 7 days past the Last Visitr
within 3 days of the next visit. You could run it when you open the db or
have a cmd_btn that the user uses.

Hope this helps

Keith
 
thanks Tina, but when I add the code to the after update I cannot click on
another record. grrr...

tina said:
try the following code in the AfterUpdate event procedure of the Last Visit
control, as

Me![Next Visit] = DateAdd("d", 10, Me![Last Visit])

note that you're going to get a ten day "hop", period, even if that means
the next visit date is a weekend or a holiday.

as for conditional formatting, if you're using A2000 or newer, open your
form in design view, select the NextVisitDate control, and on the menu bar
click Format, Conditional Formatting, and select Field Value Is, "greater
than", and add the expression

DateAdd("d", -5, [Next Visit])

hth


Jimbo said:
I've struggled with the correct subject line as it is, so I'll have a tough
time explaining what I need. I have a form with two fields
Last Visit
Next Visit
I'm entering the last visit date in using a calendar entry that works fine.
I would like to code an event that will automatically add 10 days to that
date and place it in the Next Visit field and use some sort of condition
formatting so that when that date approaches within a 3 or 4 day time frame
it turns to red text or something. I hope I made myself clear.

Thanks in advance,

Troy
 
well, setting a value in a control *should* have nothing to do with moving
to another record. does the [Next Visit] control actually get updated? what
happens when you try to move to another record? do you get an error message?


Jimbo said:
thanks Tina, but when I add the code to the after update I cannot click on
another record. grrr...

tina said:
try the following code in the AfterUpdate event procedure of the Last Visit
control, as

Me![Next Visit] = DateAdd("d", 10, Me![Last Visit])

note that you're going to get a ten day "hop", period, even if that means
the next visit date is a weekend or a holiday.

as for conditional formatting, if you're using A2000 or newer, open your
form in design view, select the NextVisitDate control, and on the menu bar
click Format, Conditional Formatting, and select Field Value Is, "greater
than", and add the expression

DateAdd("d", -5, [Next Visit])

hth


Jimbo said:
I've struggled with the correct subject line as it is, so I'll have a tough
time explaining what I need. I have a form with two fields
Last Visit
Next Visit
I'm entering the last visit date in using a calendar entry that works fine.
I would like to code an event that will automatically add 10 days to that
date and place it in the Next Visit field and use some sort of condition
formatting so that when that date approaches within a 3 or 4 day time frame
it turns to red text or something. I hope I made myself clear.

Thanks in advance,

Troy
 
Back
Top