Private Sub Command1_Click()<br/> Dim a As Single<br/> Dim b As Single<br/> Dim c As Single<br/> Dim d As Single<br/> Dim m As Single<br/> Dim n As Single<br/> Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\桌面\任雪艳\任雪艳毕设\切削用量表.mdb;Persist Security Info=False"<br/> strSQL = "select * From 切削用量表 where 1=1 "<br/> If Text1.Text <> "" Then strSQL = strSQL + " and 刀具名称='" + Text1.Text + "'"<br/> If Text1.Text <> "" Then strSQL = strSQL + " and 刀具材料 ='" + Text2.Text + "'"<br/> If Text1.Text <> "" Then strSQL = strSQL + " And 刀具直径=" + Text3.Text<br/> If Text1.Text <> "" Then strSQL = strSQL + " and 刀具齿数 =" + Text4.Text<br/> If Text1.Text <> "" Then strSQL = strSQL + " and 工件牌号='" + Form6.Text3.Text + "'"<br/> Adodc1.RecordSource = strSQL<br/> Adodc1.Refresh<br/> DataGrid1.Refresh<br/> <br/> On Error Resume Next<br/> a = Adodc1.Recordset!切削深度<br/> c = Adodc1.Recordset!每齿进给量<br/> m = Adodc1.Recordset!切削速度<br/> Do<br/> Adodc1.Recordset.MoveNext<br/> b = Adodc1.Recordset!切削深度<br/> d = Adodc1.Recordset!每齿进给量<br/> n = Adodc1.Recordset!切削速度<br/> If a < b Then<br/> a = b<br/> c = d<br/> m = n<br/> End If<br/> Loop While Not Adodc1.Recordset.EOF<br/> Adodc1.Refresh<br/> DataGrid1.Refresh<br/> Text10.Text = a<br/> Text8.Text = m<br/> Text9.Text = c<br/>End Sub<br/><br/>方便的话,发数据库文件来,我帮你调试侃侃<br/>zouql@ufida.com.cn