Office中国论坛/Access中国论坛

标题: 如可进行双参数控制查询? [打印本页]

作者: kelind    时间: 2003-8-13 04:10
标题: 如可进行双参数控制查询?
主题:双参数控制的查询,我错在哪里??发贴时间:2003/08/12 03:56pm

有一表"标密" 
  温度    视密   标密
  5     711    718
  6     711    717
  7     711    715
  5     713    717
  6     713    715
  7     713    712
  5     715    717
  6     715    716
  7     715    714

温度从0-40,  视密只有奇数,现要查询标密,做一窗体,三文本框,分别为"温度","视密",标密"  写了一段如下, 显示错误13,不知错在哪里?如何改?DLOOKUP 语句是否适用于双参数查询?请指教.
Private Sub 标密_Click()
Dim aa As Integer, ab As Single, bb As Single, cc As Single
 aa = Int(Me.视密)
 ab = (Me.温度)
 If aa Mod 2 = 1 Then
  Me.标密 = DLookup("[标密]", "标密", "[温度]=" & ab And "[视密]=" & aa)
Else
 bb = DLookup("[标密]", "标密", "[温度]=" & ab And "[视密]=" & aa)
 cc = DLookup("[标密]", "标密", "[温度]=" & ab And "[视密]=" & aa + 1)
 Me.标密 = bb + (cc - bb) / (Val(Me.视密) - aa)
 End If
End Sub
  






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