?
Solved

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

Posted on 2006-04-28
2
Medium Priority
?
240 Views
Last Modified: 2010-04-07
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
0
Comment
Question by:Paulstott
2 Comments
 
LVL 28

Expert Comment

by:vinnyd79
ID: 16563481

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
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 2000 total points
ID: 16563483
Set dbs = New ADODB.Connection
 dbs.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test\backend.mdb;"
 dbs.Open

dim rs as ADOdb.recordset


set rs = dbs.Execute("SELECT Count(tblholdingdata.message) as count ") _
& "From tblholdingdata" _
& "GROUP BY tblholdingdata.date" _
& "HAVING (((tblholdingdata.date)=Date()));"

numbertoday.Text = rs("count ") & "   " & date()
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question