Link to home
Start Free TrialLog in
Avatar of Paulstott
Paulstott

asked on

Text box on a form to show number of records with todays date

Hi EE

A little stuck here, I have a from in VB6 and I want to show the number of records in a table with todays date

 Set dbs = New ADODB.Connection
 dbs.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test\backend.mdb;"
 dbs.Open

numbertoday.Text = dbs.Execute("SELECT tblholdingdata.date, Count(tblholdingdata.message)") _
& "From tblholdingdata" _
& "GROUP BY tblholdingdata.date" _
& "HAVING (((tblholdingdata.date)=Date()));"

I am probably going the wrong way about this, any ideas?

Thanks in advance
Avatar of vinnyd79
vinnyd79


Here's one way:

Dim rs As adodb.Recordset
Set rs = New adodb.Recordset
rs.Open "Select tblholdingdata.date from tblholdingdata Where tblholdingdata.date=#" & Date & "#", dbs, adOpenForwardOnly, adLockReadOnly
MsgBox rs.RecordCount
rs.Close
Set rs = Nothing
ASKER CERTIFIED SOLUTION
Avatar of EDDYKT
EDDYKT
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial