Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date + months + 30 days 1

Status
Not open for further replies.

MICKI0220

IS-IT--Management
Jul 20, 2004
337
US
Does anyone know how to code a date calculations of months + 30 days grace period. I am trying to calculate end of commissions on a contract. For example. The contract date starts 6/1/2008. If we pay commissions for 24 months on this type of contract and we have a grace period of 30 days, the date the commission ends should be 6/30/2010. Any help coding this would be appreciated.

Thanks

 
dateadd("m",24,contractdate)+dateadd("d",30,dateadd("m",24,contractdate))
 
strongm

I have tried.
DoCmd.RunSQL ("Update tbl_ats_CommissionWork Set DayCommEnds = dtContractStart_dt + ((NumOfMonths)*30)")
 
PWise

I tried this and get a Compile erro, syntax error.

DoCmd.RunSQL ("Update tbl_ats_CommissionWork Set DayCommEnds = dateadd('m', 24, dtContractdate)+ dateadd('d',30,dateadd('m',24,dtContractdate))
 
PWise


What does the 24 mean in your example?
 
Sorry sb just this
also missing 1 closeing prenacies
dateadd("d",30,dateadd("m",24,contractdate)))
 
PWise
I coded this:

DoCmd.RunSQL ("Update tbl_ats_CommissionWork Set DayCommEnds = dateadd("d",30,dateadd("m",24,contractdate)))

I get this:

Compile Error
Expected List Separator or )


Thanks for your help.
 

PWise

24 in my example is not static it is the value assigned to "NumOfMonths" it gets the value from whatever the field "NumOf Months" has in it....It could be 24, 1 999 etc. so the original code I tried that comes short of the date is
DoCmd.RunSQL ("Update tbl_ats_CommissionWork Set DayCommEnds = dtContractStart_dt + ((NumOfMonths)*30)")
 
What about this ?
Code:
DoCmd.RunSQL "UPDATE tbl_ats_CommissionWork SET DayCommEnds=30+DateAdd('m',NumOfMonths,dtContractStart_dt)"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
yes that worked also. Sorry I am slow on updating this week.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top