Printing an Invalid Date – CODESOFT Problem


This article discusses the problem of users entering, and the label software printing, invalid dates such as “use by”, “best by” or “expiration” dates.


  • Label design prompts user for date (e.g. manufacture date, best buy date, expiration date, etc.)
  • User enters invalid date
  • Software prints invalid date


When the CODESOFT prompts the user for to enter a date, a When Printed data source is used to capture the data. Without adding any Formula data source, CODESOFT will display exactly what is entered.  If the value entered is an invalid date, that invalid date will be displayed.


Invalid dates can be prevented by NOT linking the label Object to the When Printed directly.  Instead, we recommend linking the label Object to a Formula data source and then using a When Printed data source as part of the formula. Any formula that uses a date related function (e.g. BestBefore, DateOffset, DateValue, etc.) will check the user entry value for a valid date.  If the date is invalid, CODESOFT will display “#ERROR” in each label Object that is linked to the invalid date entry.

Formula Screen Showing BestBefore Function (with When Printed data source)

CODESOFT Label with #ERROR (Invalid Date Entered)

Essentially the Formula data source with a Date & Time function can act as a screening tool to prevent invalid dates from getting into the label.



Was this article helpful?

Related Articles