I am creating form in access in which i have to implement cascading combo boxes , data in lower combo box is dependent on its parent value selected by user. Here is form
我在访问中创建表单,我必须实现级联组合框,下部组合框中的数据取决于用户选择的父值。这是表格
on left side is structure of the table and on right side is form. Problem is I am getting error of data type mismatch , unable to understand why this is happening. In the afterupdate event of Diametre of Drill I am populating cutting speed . Whenever I press drop down of Cutting Speed "Datatype mismatch in criteria expression" occurs. Here is code of afterupdate event of Diametre of Drill
在左侧是桌子的结构,在右侧是形式。问题是我收到数据类型不匹配的错误,无法理解为什么会发生这种情况。在Diametre of Drill的后续事件中,我正在填充切割速度。每当我按下切割速度下拉“标准表达式中的数据类型不匹配”时。这是Drill Diametre的后续事件代码
Private Sub cboDiameterDrilling_AfterUpdate()
cboCuttingSpeedDrilling.RowSource = "Select DISTINCT tblDrilling.cuttingSpeed " & _
"FROM tblDrilling " & _
`"WHERE tblDrilling.materials = '" & cboMaterialDrilling.Value & "' AND tblDrilling.diaOfDrill = '` `cboDiameterDrilling.Value ' " & _`
"ORDER BY tblDrilling.cuttingSpeed;"
End Sub
I think problem is in WHERE Clause . Any help would be greatly appreciated. Thank you
我认为问题出在WHERE Clause中。任何帮助将不胜感激。谢谢
2 个解决方案
#1
3
You've surrounded the reference to the object's value (cboDiameterDrilling.Value ) in single quotes.
您已用单引号包围对象值(cboDiameterDrilling.Value)的引用。
AND tblDrilling.diaOfDrill = ' & cboDiameterDrilling.Value & "'"
Solution : AND tblDrilling.diaOfDrill = " & cboDiameterDrilling.Value & " " & _
解决方案:AND tblDrilling.diaOfDrill =“&cboDiameterDrilling.Value&”“&_
#2
0
I think you missed a ". Try:
我想你错过了一个“。试试:
Private Sub cboDiameterDrilling_AfterUpdate()
cboCuttingSpeedDrilling.RowSource = "Select DISTINCT tblDrilling.cuttingSpeed " & _
"FROM tblDrilling " & _
`"WHERE tblDrilling.materials = '" & cboMaterialDrilling.Value & "' AND tblDrilling.diaOfDrill = '" & cboDiameterDrilling.Value & "' " & _
"ORDER BY tblDrilling.cuttingSpeed;"
End Sub
#1
3
You've surrounded the reference to the object's value (cboDiameterDrilling.Value ) in single quotes.
您已用单引号包围对象值(cboDiameterDrilling.Value)的引用。
AND tblDrilling.diaOfDrill = ' & cboDiameterDrilling.Value & "'"
Solution : AND tblDrilling.diaOfDrill = " & cboDiameterDrilling.Value & " " & _
解决方案:AND tblDrilling.diaOfDrill =“&cboDiameterDrilling.Value&”“&_
#2
0
I think you missed a ". Try:
我想你错过了一个“。试试:
Private Sub cboDiameterDrilling_AfterUpdate()
cboCuttingSpeedDrilling.RowSource = "Select DISTINCT tblDrilling.cuttingSpeed " & _
"FROM tblDrilling " & _
`"WHERE tblDrilling.materials = '" & cboMaterialDrilling.Value & "' AND tblDrilling.diaOfDrill = '" & cboDiameterDrilling.Value & "' " & _
"ORDER BY tblDrilling.cuttingSpeed;"
End Sub