您好我只需要包含的標準的標準得到的記錄數= 從AQ_SEG表中的字段SEG_OPE_REMARQ RS某處ACCESS我想從BD訪問
我只需要得到RS部分
一切都在代碼完成其他工作細
Sub GetNumbersSigeqR()
'Get Retrait SIGEQ de AQ_SEG_EPEL_XX.mdb.mdb
Dim mrc As String
Dim retrait As String
mrc = Val(Range("D2").Value)
If Len(mrc) < 2 Then
mrc = "0" + mrc
End If
retrait = "AQ_SEG_EPEL_" + mrc + ".mdb"
Dim folderPath As String
folderPath = Application.ActiveWorkbook.Path
Dim cn As Object
Dim rs As Object
Dim strSql As String
Dim strConnection As String
Set cn = CreateObject("ADODB.Connection")
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & folderPath & "\" & retrait
strSql = "SELECT Count(*) FROM AQ_SEG ;"
cn.Open strConnection
Set rs = cn.Execute(strSql)
Sheets("T9Cp1").Range("G97").Value = rs.Fields(0)
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
你的意思是你想只算符合特定條件的行? – CLR
是的標準是在現場包含RS。我想獲得包含th值* RS *的記錄的計數,無論前後是什麼字符串 –