Hello,
I am trying to create a script to restrict users from entering a date too far into the future for invoice entries. I think I am close, but the date I am getting is in the wrong format, and is showing the date and the time. I have tried a few things but can't seem to get this working, and keep getting a "Type Mismatch" error. I would appreciate any help. Here is my code:
invtime=""
sNowTime=""
cValidFutureDate=""
cValidFuture=""
'sNowTime = Year(now) & Right(100 + Month(now), 2) & Right(100 + Day(now), 2)
retVal = oBusObj.GetValue("InvoiceDate$", dInvDate)
'dInvDate = cdate(invtime)
cValidFuture = DateAdd("D",5,now)
retVal = oSession.FormatDate(cValidFuture,cValidFutureDate,"%Y%M%D")
retVal = oSession.AsObject(oSession.UI).MessageBox(CStr(dInvDate))
retVal = oSession.AsObject(oSession.UI).MessageBox(CStr(cValidFutureDate))
if dInvDate>cValidFutureDate then
retVal = oSession.AsObject(oSession.UI).MessageBox(CStr("Future"))
end if