local vDate, lcThisPropName, lcControlSource lcThisPropName = 'dBirth_Date' lcControlSource = 'employee.birth_date' vDate = &lcControlSource if isnull(vDate) or empty(vDate) this.&lcThisPropName = ctod(' / / ') else this.&lcThisPropName = ttod(vDate) endif RETURN THIS.&lcThisPropNameHere is the assign method...
lparameters vNewVal local lcThisPropName, lcControlSource, lcFieldName, lcTableName, lni lcThisPropName = 'dBirth_Date' lcControlSource = 'employee.birth_date' lni = at('.', lcControlSource) lcTableName = left(lcControlSource, lni - 1) lcFieldName = substr(lcControlSource, lni + 1) if empty(vNewVal) replace &lcFieldName with .null. in &lcTableName else replace &lcFieldName with dtot(m.vNewVal) in &lcTableName endif THIS.&lcThisPropName = m.vNewValFinally, change the ControlSource property on the text box to "thisform.dbirth_date". That's all there is to it. Notice that I set values in the lcThisPropName and lcCountrolSource varables. This makes it easier to use copy/paste to other date related controls.