I need some help here. It is about format date on IsDate Function. It seems, that i can't get it right. I hope you can assist me on this. This is what i am trying to achieve. User Input a date in MskEffective Date and automatically Isdate function generate an Expiry Date in MskExpiry. My Problem is each time i enter an effective date it prompt me an Error stated Invalid Property Value on <<FormName.mskExpiry = YearDate - 1>>. Below are my coding. I believe it is my coding problem. I have solved a couple of Error on Date but not this time. I am appreciate with anyone help. Thank you in advance.
As you can see there are couple of Remarks which i tested out but all fail.VB Code:
Public Sub Validate(FormName As Form) IntervalY = "yyyy" If IsDate(FormName.mskEffective) = False Then MsgBox "Date Wrong Format.Please check Date", vbCritical, "Date Format Incorrect" FormName.mskEffective.SetFocus Exit Sub End If FirstDate = FormName.mskEffective 'FirstDate = Format(FirstDate, "dd-mm-yyyy") number = 1 YearDate = DateAdd(IntervalY, number, FirstDate) 'YearDate = Format(FirstDate, "dd-mm-yyyy") 'FormName.mskExpiry = Format(FormName.mskExpiry, "dd-mm-yyyy") FormName.mskExpiry = YearDate - 1 'ExpiryDate Must Minus One Day End Sub




Reply With Quote