Office中国论坛/Access中国论坛
标题:
Dlookup Dsum 的2471错误 参数中嵌入标量
[打印本页]
作者:
mingxuan1313
时间:
2012-6-13 11:38
标题:
Dlookup Dsum 的2471错误 参数中嵌入标量
数字变量 这么用 DMax("[RecordNumber]", "TblDocket", "[FiscalYear] = " & strLastFiscalYear) + 1
意思是 [FiscalYear] = strLastFiscalYear) + 1
字符串变量这么用 DLookup("[Password]", "Staff", "[LoginID]='" & Me.txtUser & "'")
意思是 [LoginID]='Me.txtUser'
还可以这么用:Me!总有效金额 = DSum("有效金额", "POS", "流水 = Form!流水号")
Try this
Dim strLastFiscalYear As String
strLastFiscalYear = strCurrentFiscalYear - 1
strNewRecordNumber = DMax("[RecordNumber]", "TblDocket", "[FiscalYear] = " & strLastFiscalYear) + 1
strLastFiscalYear is a variable, you have made part of a literal string (it need concatenating into the string as above).
Also, I think 'strCurrentFiscalYear', 'strLastFiscalYear' and 'strNewRecordNumber' should be Integers not a strings ??
MTB
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3