Var = CurrentProject.Connection.Execute( _
"SELECT COUNT(*) FROM tblBankAIB " _
& " WHERE AIBCreditValue<>0 ").Collect(0)
MsgBox "There are " & Var & " lodgements with no Giro reference"
End Sub
Dim rs as DAO.Recordset
strSQL = "SELECT COUNT(*) as Lodgements FROM tblBankAIB " _
& "WHERE AIBCreditValue<>0"
debug.print strSQL
set rs = currentdb.openrecordset(strSQL, , dbfailonerror)
Var = rs!Lodgements
rs.close
set rs = nothing
MsgBox "There are " & Var & " lodgements with no Giro reference"