Office中国论坛/Access中国论坛
标题:
求助有关“日资金帐余额查询”问题
[打印本页]
作者:
zzll15888
时间:
2006-8-24 10:20
标题:
求助有关“日资金帐余额查询”问题
本人要创建一个“日资金帐余额查询”,以下是修改后的代码,但在运行时,系统提示“用于函数参数的个数不对,在查询表达式 `h([凭证名称].[发生日期`中。请帮助修改一下,XIEXIE.
'日资金帐余额
Public Function h(strCodeID As String, d As Date) As Currency
Set cn = Application.CurrentProject.Connection
Set rs = CreateObject("ADODB.Recordset")
'将材料代码和日期代入到查询条件中去
strSQL = "SELECT 凭证明细清单.凭证名称,Sum(([入库数量] - [出库数量])) AS 余额 " & _
"FROM 凭证明细清单 " & _
"WHERE 凭证明细清单.发生日期< #" & d & "# And 凭证名称 ='" & strCodeID & "' " & _
"GROUP BY 凭证明细清单.凭证名称;"
rs.Open strSQL, cn, 1
If rs.EOF = True Then Exit Function
h = rs("余额")
'MsgBox k
rs.Close
Set rs = Nothing
Set cn = Nothing
End Function
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3