I need a script to calculate an expiry date using an integer and an initial date.
I have no experience with coding, but I tried the following code copied from a YouTube video;
"Private Sub date_Post_Change()
Me.date_Exp = Adddate_Exp(Me.date_Post, Me.txtVal)
End Sub
Public Function Adddate_Exp(date_Post As Date, txtVal As Integer) As Date
Dim rst As Recordset
Dim db As Database
Dim date_Exp As Date
Dim icount As Integer
End Function"
I attached a screenshot image of the form showing I am getting a result in Time instead of Date. I need the value in "Validity" to be added to the date in "Post Date" to give the Expiry Date.
The value in Validity field changes based on the Voucher name selected in the Combobox above it.
This is the flow;
- Voucher Name is selected from the combobox
>voucher name determines the value in the Validity field.
>the Post Date is chosen
>the value in the Validity field is added to the Days part of the date in Post Date field to give Expiry date.
Any help will be greatly appreciated, thanks.