mLoadFile.mSqlCls = "SELECT 項次_INV主檔.MSGCODE,項次_INV主檔.SERSNO,項次_INV主檔.項次號碼,項次_INV主檔.數量,項次_INV主檔.UNITAMT,項次_INV主檔.報單淨重 FROM 項次_INV主檔 WHERE 項次_INV主檔.MSGCODE AND SERSNO= '" & getAppTxt5.Text & "' ORDER BY 項次_INV主檔.項次號碼 ASC" '測試
End Select
End Sub
Public Function clearDataNWSource(ByVal dataPath As String, ByVal mAppNo As String)
Application.ScreenUpdating = False
On Error GoTo ErrHandle
Set mCon = New ADODB.Connection
Select Case dataPath
Case Is = "MYSQL"
With mCon
.Open mconStr
End With
Case Else
With mCon
.Open mconStr & mDataSource
End With
End Select
Set mRst = New ADODB.Recordset
With mRst
.ActiveConnection = mCon
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockPessimistic
.Source = mSql
.Open
End With
If Not mRst.EOF Then
mData1 = mRst.GetRows
End If
's = mRst.Fields.Count
With mSht
mRow = .Range("c" & .Rows.Count).End(xlUp).Row
End With
For m = 2 To mRow
cStr1 = mSht.Cells(m, 1)
cStr2 = mSht.Cells(m, 2)
cStr3 = mSht.Cells(m, 3)
cStr4 = mSht.Cells(m, 4)
cStr5 = mSht.Cells(m, 5)
mRst.MoveFirst
Do Until mRst.EOF = True
mStr1 = mRst.Fields("MSGCODE")
mStr2 = mRst.Fields("SERSNO")
mStr3 = mRst.Fields("項次號碼")
mStr4 = mRst.Fields("數量")
mStr5 = mRst.Fields("UNITAMT")
If cStr1 = mRst.Fields("MSGCODE") And cStr2 = mRst.Fields("SERSNO") And cStr3 = mRst.Fields("項次號碼") And cStr4 = mRst.Fields("數量") And cStr5 = mRst.Fields("UNITAMT") Then