|
我做的查询,不知道怎么的余额查不出来和F列、H列查不到数据,请各位帮我看看哪里出错了,代码如下
Private Sub CommandButton1_Click()
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strsql As String
cnn.Open "provider=microsoft.jet.oledb.4.0;extended properties='excel 8.0;hdr=no';data source=" & ActiveWorkbook.FullName
strsql = "select f2 from [报表$a:b] where f1='" & [h1] & "'"
Set rs = cnn.Execute(strsql)
Range("i5").CopyFromRecordset rs
strsql = "select * from [收付款$a:h] Where f1 >=#" & [b1] & "# and f1<=#" & [b2] & "# and f3='" & Range("h1") & "'"
Set rs = cnn.Execute(strsql)
Range("a6").CopyFromRecordset rs
rs.Close
Set rs = Nothing
cnn.Close
Set cnn = Nothing
End Sub
复件 客户往来系统.rar
(139.56 KB, 下载次数: 10)
|
|