我的程序中有一个计算字段,它计算的公式随时会变,请问是否可以通过defaultExpress属性来设置计算公式,还是一定要在OnCalcFields事件中编程计算。若可以如何设置,为什么我设置后,程序总报错。例如我已有d1字段,d2为计算字段,现在我把d2字段的defaultExpress属性设为d1,想使得d2字段的值等于d1字段。但程序执行总报错field 'd2' can not be used in filter expression 。为什么!!请高手解答。

解决方案 »

  1.   

    Set DefaultExpression to provide a default value for a field. DefaultExpression can be any valid SQL value expression that does not refer to field values. If the expression contains literals other than numeric values, they must appear in quotes. For example, a default value of noon for a time field is'12:00:00'
    including the quotes around the literal value.Note: If you supply a value for DefaultExpression, this value takes precedence over any default values for the field implemented on the database server. This is because DefaultExpression is applied to the field in your application before any edits are sent to the server.
      

  2.   

    defaultExpress中的值不能引用其他字段值