f 是一個自定義函數(shù),原型如下,作用是為了計算當前日期的余額,其實這個實例也可以直接在窗體的Text控件里用DSUM函數(shù)實現(xiàn)的: Public Function f(d As Date) As Currency Dim a As Currency Dim b As Currency a = Nz(DSum("[銀行存款]![存入]", "[銀行存款]", "[日期] <= # " & d & "#")) b = Nz(DSum("[銀行存款]![提款]", "[銀行存款]", "[日期] <= # " & d & "#")) f = a - b End Function
f 是一個自定義函數(shù),原型如下,作用是為了計算當前日期的余額,其實這個實例也可以直接在窗體的Text控件里用DSUM函數(shù)實現(xiàn)的:
Public Function f(d As Date) As Currency
Dim a As Currency
Dim b As Currency
a = Nz(DSum("[銀行存款]![存入]", "[銀行存款]", "[日期] <= # " & d & "#"))
b = Nz(DSum("[銀行存款]![提款]", "[銀行存款]", "[日期] <= # " & d & "#"))
f = a - b
End Function