 |
|
 |
mhpate Level: Trainee
 Registered: 21-04-2007 Posts: 3
|
Record count-Solved
I have a lotto program where I would like to count how many time a number has been entered in each Field.
db = Lotto
table = Cash3
fields = Zero, One, Two ect.
Code give correct count for field Zero, but all the rest are wrong.
Dim cn As adodb.Connection
Dim rs As adodb.Recordset
Call SetWindowPos(Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
frmCash3.Left = (Screen.Width - frmCash3.Width) / 2
frmCash3.Top = (Screen.Height - frmCash3.Height) / 2
Me.MousePointer = vbHourglass
Set cn = New adodb.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= C:\Mikes\Loto\Lotto.mdb"
cn.Open
Set rs = New adodb.Recordset
rs.Open "SELECT Count (Zero) AS cnt FROM CASH3", cn, adOpenKeyset, adLockPessimistic, adCmdText
lblZero.Caption = rs.Fields("cnt").Value
rs.Close
rs.Open "SELECT Count (One) AS cnt FROM CASH3", cn, adOpenKeyset, adLockPessimistic, adCmdText
lbl1(1).Caption = rs.Fields("cnt").Value
rs.Close
|
Thanks
[Edited by mhpate on 22-04-2007 at 04:49 PM GMT]
|
|
22-04-2007 at 12:17 AM |
|
|
mhpate Level: Trainee
 Registered: 21-04-2007 Posts: 3
|
Re: Record count- Solved
The space was it.
Thank you
|
|
22-04-2007 at 04:48 PM |
|
|
|
|
 |
 |