'-------------- Query ------------ Sub pu1tj_write () DIM MyCN As New AdoDB.Connection Dim Myrs As New AdoDDB.Recordset Dim Strcon As String '------------- ADO database connection string ------------- strcon = "provider = sqloledb; server = 172.16.2.2; uid = sa; pwd = TPCIMS; Database = Man "'DL580-1 on error goto error: mycn.connectionstring = strcon mycn.commandtimeout = 0 mycn.Ars.activeConnection = mycn' ------------- Insert Data inquired ------------ m = 4 n = 2 '---------------- Open the stored procedure ------- ------ MyStr = "Execute Pu1_tj_zhangzs'" TRIM (TXT_DATE0.TEXT) "'" TRIM (TXT_DATE.TEXT) "'" "Myrs.Open MyStr Do While Not Myrs.eof Worksheets (" TJ "). Cells (M, N - 1) = m - 3 IF CSTR (TRIM (MYRS! Furnace number)) <>" 09999 "THEN WORKSHEETS (" TJ "). Cells (M, N) = Trim (MyRS ! 号) Else Worksheets ("tj"). Cells (m, n) = "" Worksheets ("tj"). Cells (M, N - 1) = "" 'Worksheets ("tj"). Cells (23 , 3). Interior.patterncolorIndex = xlautomatic end if Worksheets ("tj"). Cells (M, N 1) = CSTR (Trim (MYRS! Branch Date)) "" CSTR (TRIM (MYRS! Introduction time)) Worksheets ("tj"). Cells (M, N 2) = Trim (MYRS! Steel) Worksheets ("TJ"). Cells (M, N 3) = TRIM (MYRS! Decell length) Worksheets (" TJ "). Cells (M, N 4) = Trim (MYRS! Exterior diameter) Worksheets (" tj "). Cells (M, N 5) = TRIM (MYRS! Ross) Worksheets (" TJ " ). Cells (M, N 6) = Trim (MYRS! Weight) Worksheets ("tj"). Cells (M, N 7) = Trim (MYRS! Location) IF LEFT (CSTR (Trim (MYRS! Furnace No.)), 1) = "0" THEN WORKSHEETS ("TJ"
). Cells (M, N 8) = TRIM (MYRS! Electric furnace time) Worksheets ("tj"). Cells (M, N 9) = Trim (MYRS! Heavy Waste) Worksheets ("TJ"). Cells ( M, N 10) = Trim (MYRS! Unhealthy) Worksheets ("TJ"). Cells (M, N 11) = Trim (MYRS! Iron Water) Worksheets ("TJ"). Cells (M, N 12) = Trim (MYRS! Sports) Worksheets ("tj"). Cells (M, N 13) = Trim (Myrs! Sponge Iron) Worksheets ("TJ"). Cells (M, N 14) = Trim (Myrs) Imported scrap) Else Worksheets ("tj"). Cells (M, N 8) = "" Worksheets ("tj"). Cells (M, N 9) = "" Worksheets ("tj"). Cells M, N 10) = "" Worksheets ("tj"). Cells (M, N 11) = "" Worksheets ("tj"). Cells (M, N 12) = "" Worksheets ("TJ" ) .Cells (M, N 13) = "" Worksheets ("tj"). Cells (M, N 14) = "" end ifrs.movenext m = m 1 loop myrs.close mycn.close Exit SUB '---------- Appeared error Perform the following code -------------- Error: msgbox err.description, vbokonly, "error message" end sub' ---- --------- Clear record function -------------- Sub clear () for i = 4 to 104 for j = 1 to 16 Worksheets ("TJ"). Cells (i, j) = "" Next JNEXT IEND SUB '----- Statistical Calculation ----------- Temporarily Nothing! SUB JS () for i = 4 to 43 Worksheets (" TJ "). Cells (44, 5) = Worksheets (" TJ "). Cells (44, 5) Worksheets (" TJ "). Cells (i, 5) Next Iend Sub
'-------------- Query ----------------- Private sub check_click () Call CLUMNS ("B: Q" ) .Autofitend sub '------------- Clear Record -------------- Private Sub Clear_Row_Click () Call Clear Column ("B: Q"). Autofitend Sub