计算MS Access数据库中的记录数,不包括NULL VALUE

时间:2014-07-23 06:54:30

标签: ms-access vb6 count null

我有一个名为call_code的表..

call_id
maintCall_plan
maintCall_unplanned
creditCalls
newBussCalls
phoneCalls

我想要做的是计算maintCall_plan中的记录数但不计算空值

这是我的代码段

Private Sub Form_Load()
Dim conConnection As New ADODB.Connection
Dim rs As New ADODB.Recordset

conConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
  App.Path & "\" & "WAR.mdb;Mode=Read|Write"
conConnection.CursorLocation = adUseClient
conConnection.Open

Dim query As String
Dim recCount As Integer

rs.Open "call_code", conConnection, adOpenForwardOnly, adLockReadOnly
txtmondayplanned.Text = rs.RecordCount
rs.Close
conConnection.Close
End Sub

问题是它正在计算所有记录,包括空值。任何帮助将不胜感激。

0 个答案:

没有答案