LOCAL lcAlias, lcField, lcType, laFields[1], ; lnElement, lnRow, lcIntegerPart, lcDecimalPart WITH This IF ! EMPTY( .ControlSource ) AND ( '.' $ .ControlSource ) IF EMPTY( .InputMask ) *** Only set the inputmask for numeric and character fields *** and check the data type of the underlying field so we *** can set it appropriately lcType = TYPE( This.ControlSource ) IF INLIST( lcType, 'C', 'N', 'I', 'Y' ) *** Parse the alias and the field name from the ControlSource lcAlias = JUSTSTEM( .ControlSource ) lcField = JUSTEXT ( .ControlSource ) *** Don't attempt to check the properties of the underlying *** field if we are bound to a form property IF UPPER( lcAlias ) # 'THISFORM' *** format the field if it is character IF lcType = 'C' .InputMask = REPLICATE( 'X', FSIZE( lcField, lcAlias ) ) ELSE AFIELDS(laFields, lcAlias) lnElement = ASCAN(laFields, UPPER(lcField)) IF lnElement > 0 lnRow = ASUBSCRIPT(laFields, lnElement, 1) IF laFields[lnRow,2] = 'N' lcIntegerPart = REPLICATE('9', laFields[lnRow, 3] - laFields[lnRow, 4] - 1) lcDecimalPart = REPLICATE('9', laFields[lnRow, 4]) .InputMask = lcIntegerPart + '.' + lcDecimalPart ELSE IF laFields[lnRow,2] = 'I' *** Max integer value is 2147483647...make sure we don't overflow .InputMask = '999,999,999' ELSE IF laFields[lnRow,2] = 'Y' *** Max currency value is 922337203685477.5807...make sure we don't overflow .InputMask = '99,999,999,999,999.9999' ENDIF && IF laFields[lnRow,2] = 'Y' ENDIF && IF laFields[lnRow,2] = 'I' ENDIF && IF laFields[lnRow,2] = 'N' ENDIF && IF lnElement > 0 ENDIF && IF lcType = 'C' ENDIF && IF UPPER( lcAlias ) # 'THISFORM' ENDIF && IF INLIST( lcType, 'C', 'N', 'I', 'Y' ) ENDIF && IF EMPTY( .InputMask ) ENDIF && IF ! EMPTY( .ControlSource ) ENDWITHMarcia