【正文】
End If End IfEnd SubPrivate Sub Form_Load() 39。設(shè)置軸、孔兩個單選框的初始狀態(tài):未選擇 = False = False 39。設(shè)定公差等級列表供用戶選擇 IT1 IT2 IT3 IT4 IT5 IT6 IT7 IT8 IT9 IT10 IT11 IT12 IT13 IT14 IT15 IT16 IT17 IT18End SubPrivate Sub optAxis_Click() 39。設(shè)定軸的基本偏差代號 a b c cd d e ef f fg g h j k m n p r s t u v x y z za zb zcEnd SubPrivate Sub optHole_Click() 39。設(shè)定孔的基本偏差代號 A B C CD D E EF F FG G H J K M N P R S T U V X Y Z ZA ZB ZCEnd Sub形狀公差查詢窗口程序代碼:Option ExplicitPrivate FL_Straightness As Single 39。定義變量,基本尺寸(直線度)Private FL_Evenness As Single 39。定義變量,基本尺寸(平面度)Private FD_Roundness As Single 39。定義變量,基本尺寸(圓度)Private FD_Cylindricity As Single 39。定義變量,基本尺寸(圓柱度)Private StraightnessGrade As String 39。定義變量,直線度公差等級Private EvennessGrade As String 39。定義變量,平面度公差等級Private RoundnessGrade As String 39。定義變量,圓度公差等級Private CylindricityGrade As String 39。定義變量,圓柱度公差等級Private Sub cboCylindricityGrade_Click() 39。通過組合框選定圓柱度公差等級 CylindricityGrade = End SubPrivate Sub cboEvennessGrade_Click() 39。通過組合框選定圓度公差等級 EvennessGrade = End SubPrivate Sub cboRoundnessGrade_Click() 39。通過組合框選定圓度公差等級 RoundnessGrade = End SubPrivate Sub cboStraightnessGrade_Click() 39。通過組合框選定直線度公差等級 StraightnessGrade = End SubPrivate Sub cmdClear_Cylindricity_Click() = = End SubPrivate Sub cmdClear_Evenness_Click() = = End SubPrivate Sub cmdClear_Roundness_Click() = = End SubPrivate Sub cmdClear_Straightness_Click() = = End SubPrivate Sub cmdReturn_Cylindricity_Click() Unload frmFormToleranceEnd SubPrivate Sub cmdReturn_Evenness_Click() Unload frmFormToleranceEnd SubPrivate Sub cmdReturn_Roundness_Click() Unload frmFormToleranceEnd SubPrivate Sub cmdReturn_Straightness_Click() Unload frmFormToleranceEnd SubPrivate Sub cmdSearch_Cylindricity_Click() Dim conn As New 39。定義ADODB的Connection對象 Dim rs As New 39。定義ADODB的Recordset對象 Dim connstr As String 39。定義連接串 FD_Cylindricity = 39。打開直線度公差數(shù)據(jù)庫 connstr = provider = 。 data source= F:\AutoCAD二次開發(fā)\減速器\ = connstr connstr = adUseClient 39。從數(shù)據(jù)庫中選擇符合條件的數(shù)據(jù):基本尺寸在給定范圍內(nèi) select * from 圓柱度 where FDimension_L amp。 FD_Cylindricity amp。 and FDimension_U = amp。 FD_Cylindricity amp。 , conn 39。據(jù)公差等級,顯示相應(yīng)公差數(shù)值 If 0 Then Select Case CylindricityGrade Case 1 = (2) Case 2 = (3) Case 3 = (4) Case 4 = (5) Case 5 = (6) Case 6 = (7) Case 7 = (8) Case 8 = (9) Case 9 = (10) Case 10 = (11) Case 11 = (12) Case 12 = (13) End Select Else MsgBox (沒有找到相關(guān)數(shù)據(jù)) End If 39。關(guān)閉程序與數(shù)據(jù)庫的連接,關(guān)閉數(shù)據(jù)庫 Set rs = Nothing Set conn = NothingEnd SubPrivate Sub cmdSearch_Evenness_Click() Dim conn As New 39。定義ADODB的Connection對象 Dim rs As New 39。定義ADODB的Recordset對象 Dim connstr As String 39。定義連接串 FL_Evenness = 39。打開直線度公差數(shù)據(jù)庫 connstr = provider = 。 data source= F:\AutoCAD二次開發(fā)\減速器\ = connstr connstr = adUseClient 39。從數(shù)據(jù)庫中選擇符合條件的數(shù)據(jù):基本尺寸在給定范圍內(nèi) select * from 平面度 where FDimension_L amp。 FL_Evenness amp。 and FDimension_U = amp。 FL_Evenness amp。 , conn 39。根據(jù)公差等級,顯示相應(yīng)公差數(shù)值 If 0 Then Select Case EvennessGrade Case 1 = (2) Case 2 = (3) Case 3 = (4) Case 4 = (5) Case 5 = (6) Case 6 = (7) Case 7 = (8) Case 8 = (9) Case 9 = (10) Case 10 = (11) Case 11 = (12) Case 12 = (13) End Select Else MsgBox (沒有找到相關(guān)數(shù)據(jù)) End If 39。關(guān)閉程序與數(shù)據(jù)庫的連接,關(guān)閉數(shù)據(jù)庫 Set rs = Nothing Set conn = NothingEnd SubPrivate Sub cmdSearch_Roundness_Click() Dim conn As New 39。定義ADODB的Connection對象 Dim rs As New 39。定義ADODB的Recordset對象 Dim connstr As String 39。定義連接串 FD_Roundness = 39。打開直線度公差數(shù)據(jù)庫 connstr = provider = 。 data source= F:\AutoCAD二次開發(fā)\減速器\ = connstr connstr = adUseClient 39。從數(shù)據(jù)庫中選擇符合條件的數(shù)據(jù):基本尺寸在給定范圍內(nèi) select * from 圓度 where FDimension_L amp。 FD_Roundness amp。 and FDimension_U = amp。 FD_Roundness amp。 , conn 39。根據(jù)公差等級,顯示相應(yīng)公差數(shù)值 If 0 Then Select Case RoundnessGrade Case 1 = (2) Case 2 = (3) Case 3 = (4) Case 4 = (5) Case 5 = (6) Case 6 = (7) Case 7 = (8) Case 8 = (9) Case 9 = (10)