Automatically calculate a date in a control based on another date.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a combo box containing a list of construction types. In it's table,
there is a corresponding column with the number of days required to process
each construction type. IE: it takes 5 days to process a shed, so, column one
is "shed" and column two is "5".

In my Form, I have a "date submitted" control, and a "date due".

Is there a way that when I select "shed" from my drop down list, it
automatically calculates from the date sumitted control, what the due date
is? IE: User would enter the submitted date, select "shed" from the drop
down list, and the due date would automatically calculate the submit date + 5
(b/c it takes 5 days to process, and it gets this value from the table
mentioned earlier).

How can this be done?

Thanks,
barkaroo
 
Put code into the AfterUpdate event of the combo box.

You'll need something like

Me.txtDueDate = DateAdd("d", Me.MyCombo.Column(1), Me.txtDateSubmitted)
 
Doug,
Thank you for your assistance.
Please be patient with me... I'm quite green and just learning how to use
the expression builder (and how it works). This is what I have - according
to your template.
=[DateDue]=DateAdd("d",[CONSTRUCT TYPE DESCRIPTION
LIST]!NumberOfDaysToProcess,[DateSubmitted])

But I'm doing something wrong b/c I keep getting the error message:"The
object doesn't contain the automation object".
I realize that you aren't looking at my screen, but do you have any ideas?
If not, could you please explain your template a little? ie: why do you use
"Me" in Me.txtDueDate? And in the second part, why do you use "d"?

Thanks again for your assistance.

Bark
 
My example assumed that you'd be using VBA. In other words, on the
Properties tab of the combo box, you'd select [Event Procedure] from the
combo box presented in the After Update event, and then type something like
what I suggested into the VB Editor that appeared.

What you've written is not valid.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



BARKAROO said:
Doug,
Thank you for your assistance.
Please be patient with me... I'm quite green and just learning how to use
the expression builder (and how it works). This is what I have - according
to your template.
=[DateDue]=DateAdd("d",[CONSTRUCT TYPE DESCRIPTION
LIST]!NumberOfDaysToProcess,[DateSubmitted])

But I'm doing something wrong b/c I keep getting the error message:"The
object doesn't contain the automation object".
I realize that you aren't looking at my screen, but do you have any ideas?
If not, could you please explain your template a little? ie: why do you use
"Me" in Me.txtDueDate? And in the second part, why do you use "d"?

Thanks again for your assistance.

Bark

Douglas J. Steele said:
Put code into the AfterUpdate event of the combo box.

You'll need something like

Me.txtDueDate = DateAdd("d", Me.MyCombo.Column(1), Me.txtDateSubmitted)



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



column
one date
+ 5
 
Back
Top