Office中国论坛/Access中国论坛

标题: 恼火的DLOOKUP,为什么总是类型不匹配? [打印本页]

作者: kelind    时间: 2004-12-31 03:56
标题: 恼火的DLOOKUP,为什么总是类型不匹配?


Private Sub 起数_GotFocus()

Dim rq As Date

Dim bz As String

Dim jh As String

Dim qs As Single

bz = Me.班次.Value

rq = Me.日期.Value

jh = Me.机号.Value

If Me.班次 = "白" Then

qs = DLookup("[止数]", "加油站流水表", "[日期] = #' & rq - 1 & '# " And "[班次] ='夜'" And "[机号]='" & jh & "'")

Me.起数 = qs

Else

qs = DLookup("[止数]", "加油站流水表", "[日期] = #" & rq & "# " And "[班次] ='白'" And "[机号]='" & jh & "'")

Me.起数 = qs

End If



End Sub

                怎么调都是"类型不匹配", 请高手帮我看看.先谢谢了!
作者: tanjh    时间: 2004-12-31 04:36
试试这个DLookup("[止数]", "加油站流水表", "[日期] = #" & rq - 1 & "#  And [班次] ='夜' And [机号]='" & jh & "'")


作者: kelind    时间: 2005-1-1 01:21
也不行![em03][em06]




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3