Hello All,
A user would like to restrict the entered dates on the SL7 FP1 Voucher & Adjustment entry screen to no more than 31 days in the future. This would prevent some of the ongoing clerical data entry errors. The restriction should be for Invoice Date and maybe other fields on the screen.
I have not done validation customizations before, only hide/show. I am also not a programmer. Below what I know so far.
I experimented in Excel and learned that the integer equivalents for some dates are as follows:
Date | Equivalent | Difference | ||
1/1/2011 | 40544 | |||
2/1/2011 | 40575 | 31 | ||
3/1/2011 | 40603 | 28 | ||
4/1/2011 | 40634 | 31 | ||
5/1/2011 | 40664 | 30 | ||
6/1/2011 | 40695 | 31 | ||
7/1/2011 | 40725 | 30 | ||
8/1/2011 | 40756 | 31 |
I theorized this would mean that a data entry comparison of the string integer equivalent against a chosen max should allow me to check if exceeded.
I opened Customization Manager | Selected Invoice Date Field | Visual Basic Editor, and entered the following IF "code" into the automatic "Private Sub" which opened as shown below:
Private Sub cinvcdate_Chk(ChkStrg As String, retval As Integer)
If retval > (retval + 31) Then retval = 0
End Sub
I saved and closed the screen. I entered an Invoice Date 32 days in the future from today (i.e. 6/19/2011) and the screen immediately closed without any messages or processing or saving, just like nothing had happened.
Could someone please help? Thank you kindly in advance.
-Luis
*This post is locked for comments