Solved

Calculating Lead time

Posted on 2008-10-29
3
349 Views
Last Modified: 2012-05-05
I would like to learn how to calculate leadtime in VBA.  I have a txtbox that has a date.  Formatted as date.  I have a txtbox that has a number.  I have another box that is a calculation of the two.  Example

txtbx1
10/29/08

txtbx2
10

txtbx3
needs to equal 10 weeks in the future starting on 10/29/08.  

I have a work around adding another txtbox4.  which is calculated as =txtbx2*7.  Then
txtbx3 is calculated as =txtbx1*txtbx4.

There has to be another way.  This question is strictly for learning and not any emergency. It would be nice to learn a new trick

net
0
Comment
  • 2
3 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 200 total points
ID: 22834749

  Take a look at DateAdd() in the on-line help, which is used to add a date plus a period.  It can be used anywhere an expression is valid (ie. a control source), and the arguments passed can be references to other controls on your form (ie.  Forms![<myFormName>]![<myControlName>].

HTH,
JimD.
0
 
LVL 4
ID: 22835347
BINGO!

=DateAdd("ww",[Text2],[Text1])

Thanks!

net
0
 
LVL 4

Author Closing Comment

by:get-ADuser -F ($_.Name -eq "Todd")
ID: 31511352
Great Help As Always!
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question