回复 5楼 owenlu1981
以下是我的部分代码
Private Sub check1_click()
If Rs.State = 1 Then
Rs.Close
End If
If Combo1.Text = "" Then
MsgBox "品牌名称不能为空,请重新输入!", 16, "提示"
Combo1.SetFocus
Exit Sub
Else
SQL = "SELECT * FROM 驾驶室偏频参数对比 WHERE 品牌='" & Combo1.Text & "' and 驱动形式='" & Combo3.Text & "'
and 平台='" & Combo2.Text & "' and 减震形式='" & Combo5.Text & "' and 悬置形式='" & Combo4.Text & "' "
Rs.Open SQL, conn, 1, 1
If Rs.RecordCount > 0 Then
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
Set DataGrid1.DataSource = Rs
Exit Sub
Else
MsgBox "输入有误,请重新输入!", 16, "提示"
Rs.Close
End If
End If
End Sub
Private Sub check2_click()
If Rs.State = 1 Then
Rs.Close
End If
If Combo6.Text = "" Then
MsgBox "品牌名称不能为空,请重新输入!", 16, "提示"
Combo6.SetFocus
Exit Sub
Else
SQL = "SELECT * FROM 驾驶室偏频参数对比2 WHERE 品牌='" & Combo6.Text & "' and 驱动形式='" & Combo7.Text & "'
and 平台='" & Combo10.Text & "' and 减震形式='" & Combo9.Text & "' and 悬置形式='" & Combo8.Text & "' "
Rs.Open SQL, conn, 1, 1
If Rs.RecordCount > 0 Then
DataGrid2.AllowAddNew = False
DataGrid2.AllowDelete = False
DataGrid2.AllowUpdate = False
Set DataGrid2.DataSource = Rs
Exit Sub
Else
MsgBox "输入有误,请重新输入!", 16, "提示"
Rs.Close
End If
End If
End Sub