Calculate future dates based on inputs

jkpats12

Registered User.
Local time
Today, 11:04
Joined
Jan 27, 2004
Messages
45
Hello,

Was wondering if it is possible to create a query or another method that would calculate future dates based on inputted info ?

For example a person inputs on a form a date completed (06/14/07) and then also selects a frequency of when this has to be revisited....monthly, quarterly, semi-annually.

So based on the date completed that the person inputs I'm trying to get the date if they select monthly of 7/14/07 (using above date example).

Any help would be greatly appreciated.

Thank you
 
Thanks Rich, not familiar with For I loop ???

Any guidance would be appreciated.

Thanks
 
Something like


Function FillTableDteDue()
Dim db As DATABASE
Dim rst As Recordset
Dim StDate As Date
Dim I As Variant
Dim ssFreq As String
ssFreq = Forms!frmDatesDue!txtFreq
Dim NoOfMnths As Integer, Heading As String, PymtType As String, Description As String, Payee As String, PaymentAmount As Currency
NoOfMnths = Forms!frmDatesDue!NoOfMnths
StDate = Forms!frmDatesDue!StDate
Set db = CurrentDb
Set rst = db.OpenRecordset("DateDue")
rst.MoveFirst
For I = -1 To NoOfMnths - 2
Select Case ssFreq
Case "Monthly"
rst.AddNew
rst!AccTypeID = Forms!frmDatesDue!AccTypeID
rst!DateDue = DateAdd("m", I + 1, StDate)
rst!Heading = Forms!frmDatesDue!Heading
rst!PymtType = Forms!frmDatesDue!PymtType
rst!Description = Forms!frmDatesDue!Description
rst!Payee = Forms!frmDatesDue!Payee
rst!PaymentAmount = Forms!frmDatesDue!PaymentAmount
rst!AccTypeID1 = Forms!frmDatesDue!txtTransf

rst.Update
rst.MoveNext
Case "Quarterly"
rst.AddNew
rst!AccTypeID = Forms!frmDatesDue!AccTypeID
rst!DateDue = DateAdd("m", I * 3, StDate)
rst!Heading = Forms!frmDatesDue!Heading
rst!PymtType = Forms!frmDatesDue!PymtType
rst!Description = Forms!frmDatesDue!Description
rst!Payee = Forms!frmDatesDue!Payee
rst!PaymentAmount = Forms!frmDatesDue!PaymentAmount
rst!AccTypeID1 = Forms!frmDatesDue!txtTransf
rst.Update
rst.MoveNext
End Select
Next I


rst.Close
Set rst = Nothing
db.Close
Set db = Nothing


End Function
 

Users who are viewing this thread

Back
Top Bottom