Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number of records

Status
Not open for further replies.

ianbar

Technical User
Jan 10, 2003
69
GB
Hi,

I need to write a query that returns the number of records that match the criteria. I do not need to see the reults just the number of records matching the criteria. Is this possible? Any help would be really appreciated.
 
Hello ianbar,
The query would look like:
Code:
SELECT COUNT(*) AS MyCount FROM MyTable WHERE ...
Good Luck, Robert
•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•
Professional, affordable, Access database solutions and assistance °•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°
 
Try something like this:

select count(*) from mytable
where condition = 1;


Of course substitute "condition = 1" with your own criteria.
 
I am trying to create a form that shows database statistics, like:

Number of Complaints: 90
Number closed: 88

How can I do this using this query, do I need to code it in VB?
 
Use the domain aggregate function DCount(). In your text box add the following control source:
=DCount("MyID", "MyTable", "Complaint = True")
and to the other box's control source:
=DCount("MyID", "MyTable", "Close = True")

Of course you will have to substitute the appropriate values, but this should give you the basic idea of what to do. Robert
•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•
Professional, affordable, Access database solutions and assistance °•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top