|
Public Sub ggggg()
Sheet5.Range("a3:q65536").ClearContents
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim str1 As String
str1 = "有差异"
Set cnn = New ADODB.Connection
str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ThisWorkbook.Path & "\V1.0 进出口管理系统.accdb;Jet OLEDB:Database Password=123456"
cnn.Open str
Set rst = New ADODB.Recordset
str = "select 到港日期,中文名称,运单号,订单号,贸易术语,卸货港,运输方式,部件号,钢卷号公式,资料净重,资料毛重,发票号码,数量,净重合计,净重差异,差异百分比 from 运输重量跟踪1 where 差异状态 = '" & str1 & "'order by 录入ID"
rst.Open str, cnn, adOpenDynamic, adLockOptimistic
Sheet5.Range("A3").CopyFromRecordset rst
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
End Sub
|
|