D
Dave
Hello
I am trying to return a count from a table into a variable. As you can see
from the code below I have the select statement counting the rows where, in
table1, invno is equal to 1. However when i run this code the messagebox is
blank ( i have tried dropping it into a text box but with the same result!).
If I run the Select line as a query though it gives me the correct count as
2. Help!!!
Thanks
Dim rst2 As ADODB.Recordset
Set rst2 = New ADODB.Recordset
With rst2
.ActiveConnection = CurrentProject.Connection
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open ("SELECT count(Table1.invno) as countofno FROM Table1 WHERE
(((Table1.invno) = 1))")
MsgBox (countofno)
End With
rst2.Close
I am trying to return a count from a table into a variable. As you can see
from the code below I have the select statement counting the rows where, in
table1, invno is equal to 1. However when i run this code the messagebox is
blank ( i have tried dropping it into a text box but with the same result!).
If I run the Select line as a query though it gives me the correct count as
2. Help!!!
Thanks
Dim rst2 As ADODB.Recordset
Set rst2 = New ADODB.Recordset
With rst2
.ActiveConnection = CurrentProject.Connection
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open ("SELECT count(Table1.invno) as countofno FROM Table1 WHERE
(((Table1.invno) = 1))")
MsgBox (countofno)
End With
rst2.Close