'Write data determination portion Sub Pu1zj_write () Dim myCn As New ADODB.Connection Dim myrs As New ADODB.Recordset Dim strcon As String' ADO database connection string strcon = "PROVIDER = SQLOLEDB; SERVER = 172.16.2.9; UID = sa; PWD = TPCIMS; Database = JTQFMIS_DATA "'DL580-1 ON Error Goto error: mycn.connectionstring = strcon' Set timeout time, indicate, will wait until the command is executed, MYCN.COMMANDTIMEOUT = 0 mycn.open myrs.activeConnection = Mycn mystr_zj = "SELECT * FROM SBR = '" CSTR (Range ("B3")) "'" "MYRS.OPEN MYSTR_ZJ IF MYRS.EOF THEN MSGBOX" Quality Inspection Station has not been determined ! ", Vbokonly," Error "EXIT SUB End If Range (" E3 ") = Trim (" H3 ") = Trim (MYRS! Steel) RANGE (" L3 ") = Trim (Myrs! Specifications) "MM" Range ("O3") = TRIM (MYRS! Contract Number) RANGE ("T5") = Trim (MYRS! Rumor) RANGE ("T6") = Trim (MYRS! Weight) Range (" C2 ") = trim (MYRS! Production Date) RANGE (" R2 ") = Trim (MYRS! Date) 'Close connection Myrs.close mycn.close Exit Sub' error Perform the following code error: msgbox err.description, vbokonly , "Error Message" End Sub 'in determination section Writing fixed length SUB DC () DIM MyCN As New AdoDB.Connection Dim MyRS AS New Ado DB.Recordset Dim strcon As String 'ADO database connection string strcon = "PROVIDER = SQLOLEDB; SERVER = 172.16.2.2; UID = sa; PWD = tpcims; DATABASE = Movex12"' DL580-1 On Error GoTo Error: myCn.ConnectionString = Strcon 'Set timeout, indicates when 0, will wait until the command is executed, MYCN.COMMANDTIMEOUT = 0 mycn.open myrs.activeConnection = mycn myStr_zj = "SELECT * j j j 11pd2 where mo =' cstr (Range" ")) " '
"MYRS.OPEN MYSTR_ZJ RANGE (" T4 ") = Trim (Myrs! DC) 'Close connection myrs.close mycn.close exit sub' error Perform the following code error: msgbox err.description, vbokonly," error message "end sub
'Write the library section Data SUB PU1RK_WRITE () DIM MyCN As New AdoDb.Connection Dim Myrs as new adoDb.recordset Dim Strcon As String' ADO Database Connection String Strin = "Provider = Sqloledb; Server = 172.16.2.2; UID = SA; PWD = TPCIMS; Database = MOVEX12 "DL580-1 ON ERROR GOTO ERROR: mycn.connectionstring = strcon 'Set timeout, indicating that the command will always wait for the command to execute mycn.commandtimeout = 0 mycn.open myrs.activeConnection = mycn 'opens the stored procedure, parameter is I3 cell content RANGE ("e10") = Range ("o10") = Range ("c9") = Range ("C2) = ") MYSTR =" Execute pu1rk_zhangzs ' cstr (Range ("E10")) "'" "" 'mYStr = "SELECT TOP 1 * from mittra"' msgbox (mystr) Myrs.open mystr 'is RECORDSET assignment' if not Isors.ers.eof the msgbox "finishing yet!" ZHANGZS "'Inserting the query data RANGE (" r9 ") = Trim (MYRS! Trading Date) Range (" B10 ") = Trim (MYRS! Furnace number) RANGE (" h10 ") = trim (MYRS! Steel) RANGE ("l10") = trim (MYRS! External diameter) RANGE ("T10") = Trim (MYRS! Decal length) "m" 'Range ("C13") = TRIM (MYRS! Operator) N = 2 'initial variable M = 11 D o While not myrs.eof cells (m, n 1) = trim (MYRS! times) Cells (M 1, N 1) = TRIM (MYRS! actual number) Cells (M 2, N 1) = Trim (MYRS! Weight) MYRS.MOVENEXT N = N 3 loop 'Worksheets ("Finishing Inventory") .protect Password: = "ZHANGZS", DrawingObjects: = true, contents: = true, Scenarios: = True 'Close connection Myrs.close Mycn.close Exit Sub'
Error performs the following code error: msgBox err.description, vbokonly, "Error Message" End Sub 'comparison results Show SUB ZJ_RK_DB ()' IF TRIM ("T4"). Text) = Replace (Replace (TRIM (Trim (Range "T10"). TEXT, "M", ""), "." "") "0" THEN 'RANGE ("E16") = "OK"' Range ("E16"). Font.colorindex = 10 'Range ("E16"). Font.bold = true' else '= "E16") = "Error"' Range ("E16"). Font.colorindex = 3 'Range ("E16"). Font .BOLD = True 'end if IF trim (Range ("T5"). TEXT) = Trim ("T11"). TEXT) THEN RANGE ("E17") = "OK" RANGE ("E17"). Font .COLORINDEX = 10 RANGE ("E17"). Font.bold = true else Range ("E17") = "Error" RANGE ("E17"). Font.colorindex = 3 Range ("E17"). Font.bold = TRUE END IF TRIM (Range ("T6"). TEXT) = Trim (Range ("T12"). TEXT) THEN RANGE ("e18") = "OK" RANGE ("E18"). Font.colorIndex = 10 Range ("e18"). Font.bold = true else Range ("e18") = "Error" RANGE ("E18"). Font.colorindex = 3 Range ("e18"). Font.bold = true endiff Batch Tracking if Trim (Range ("B3"). TEXT) = Trim ("B10"). TEXT) THEN RANGE ("E19) =" OK "Range (" E19 "). Font.colorindex = 10 RANGE ("e19"). Font.bold = true else Range ("e19") = "Error" Range ("E19"). Font.colorindex = 3 Range ("e19"). Font.bold = true end If End Sub 'Clears Record Sub Clear ()' Determined Section Clear Range ("C2") = ""
Range ("R2") = "" Range ("E3") = "" RANGE ("H3") = "" Range ("L3") = "" Range ("O3") = "" Range ("T4" ) = "" "T5") = "" RANGE ("T6") = "" "" c9 ") =" "Range (" r9 ") =" "RANGE (" B10 " ) = "" "H10") = "" RANGE ("O10") = "" RANGE ("L10") = "" "RANGE (" e10 ") =" "" "=" "for i = 11 to 13 for j = 3 to 15 cells (i, j) = "" Next J next I 'Clear comparison results RANGE ("E16") = "" RANGE ("E17) =" "Range (" E18 ") =" "Range (" e19 ") =" "" Clear inventory transaction history content for i = 7 to 24 for j = 2 to 12 Worksheets ("Inventory Trading History") .Cells (i, j) = "" Next j Next i End SubPrivate Sub Worksheet_Change (ByVal Target As Range) If Target.Column = 2 And Target.Row = 3 Then Call Clear If Range ( "B3") <> "" Then Call Pu1zj_write 'Call dc Call Pu1rk_write Call Zj_Rk_Db Call pu1_kucun_write end if end ifend sub
Sub Pu1_kucun_write () Dim myCn As New ADODB.Connection Dim myrs As New ADODB.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' Set timeout, indicates 0, will wait until the command is executed, MYCN.COMMANDTIMEOUT = 0 mycn.open myrs.activeconnection = mycn myStr_zj =" Execute PU1_Kucun '" CSTR (Range (" E10 ")) "' "myrs.open myStr_zj n = 2 'initial variable M = 7 do while not myrs.eof Worksheets (" Inventory Trading History ") .Cells (M, N ) = Trim (MYRS! Operator) Worksheets ("Inventory Trading History") .Cells (M, N 1) = Trim (MYRS! Material number) Worksheets ("Inventory Trading History") .Cells (M, N 2 = Trim (MYRS! Order number) Worksheets ("Inventory Trading History"). Cells (M, N 3) = Trim (MYRS! Furnace number) Worksheets ("Inventory Trading History") .Cells (M, N 4 = Trim (MYRS! "Worksheets (" Inventory Trading History ") .Cells (M, N 5) = Trim (Myrs! Intrinsic weight) Worksheets (" Inventory Trading History ") .Cells (M, N). 6) = trim (MYRS! Intrinsic Route) Worksheets ("Inventory Trading History") .Cells (M, N 7) = TRIM (MYRS! Actual Rules) Worksheets ("Inventory Trading History") .Cells ( M, N 8) = Trim (Myrs! Batch number) Worksheets ("Inventory Trading History") .Cells ( m, n 9) = Trim (MYRS! Location) Worksheets ("Inventory Trading History") .Cells (M, N 10) = Trim (Myrs! Trading Date) Myrs.MOVENEXT M = M 1 LOOP 'Close Connect myrs.close mycn.close exit sub 'error Perform the following code error: msgbox err.description, vbokonly, "Error Messagend Sub-- Picture: Enter" furnace "and return to the car to get results.
- Screenshot in album