|
Private Sub Command11_Click()
Dim Filter As String
Dim rs As New ADODB.Recordset
Dim rsSum As New ADODB.Recordset
Dim cnn As New ADODB.Connection
Dim sSQL As String
Set cnn = CurrentProject.Connection
sSQL = "select 联系id from aaa"
rs.Open sSQL, cnn, adOpenKeyset, adLockReadOnly
Do While Not rs.EOF
sSQL = "SELECT sum(Nz([单价],0)*Nz([数量],0)-Nz([支付],0)) As Balance from bbb where (联系id=" & rs.Fields(0) & "and 是否=false and 方式 like '*现金*')"
rsSum.Open sSQL, cnn, adOpenKeyset, adLockReadOnly
If rsSum.Fields("Balance") <> 0 Then
Filter = Filter & rs.Fields(0) & ";"
End If
rsSum.Close
rs.MoveNext
Loop
MsgBox Filter
rs.Close
Set rs = Nothing
Set rsSum = Nothing
Set cnn = Nothing
End Sub
该函数中
sSQL = "SELECT sum(Nz([单价],0)*Nz([数量],0)-Nz([支付],0)) As Balance from bbb where (联系id=" & rs.Fields(0) & "and 是否=false and 方式 like '*现金*')"
方式 like "*现金*" 的功能为什么实现不了呢?我调试过,好像非得like后面的参数要百分之一百匹配才能找到出来,但我希望的是模糊查询,希望各位高手指教一二,谢谢
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|