Cyprexx IT
asked on
Add days to date
I'm trying to figure out how to add days to a date in vba..
it cannot exclude weekends and holidays, it must count +17 complete days.\
thanks
it cannot exclude weekends and holidays, it must count +17 complete days.\
thanks
you mean dateadd("d", 17, yourdate) ?
http://www.techonthenet.com/excel/formulas/dateadd.php
http://www.techonthenet.com/excel/formulas/dateadd.php
you can also do this
date() +17
date() +17
ASKER
I mean like, when I click on text field AuctionDate I want it to take PublishedDate field and add +17 days and display it in AuctionDate field.
Private Sub AuctionDate_Click()
Me.PublishedDate = DateAdd("d", 17, [AuctionDate])
Me.Recalc
End Sub
Trying to accomplish that
Private Sub AuctionDate_Click()
Me.PublishedDate = DateAdd("d", 17, [AuctionDate])
Me.Recalc
End Sub
Trying to accomplish that
Private Sub AuctionDate_Click()
Me.AuctionDate = DateAdd("d", 17, [PublishedDate])
Me.Recalc
End Sub
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Generally calculated values like that shouldn't be stored in your tables. It creates redundant data, and can complicate things if a field that the calculation is based on changes.
With that understood, if you use this in the control source property of your AuctionDate textbox, it will display the value, and automatically change if PublishedDate changes:
= DateAdd("d", 17, [PublishedDate])
(Include the = sign in your control source)
With that understood, if you use this in the control source property of your AuctionDate textbox, it will display the value, and automatically change if PublishedDate changes:
= DateAdd("d", 17, [PublishedDate])
(Include the = sign in your control source)
dateadd("d", 17, [DateField])
to add 17 days to todays date
dateadd("d", 17, Date())