Solved

Displaying the result of SQL in msgbox

Posted on 2014-02-10
3
589 Views
Last Modified: 2014-02-10
I have a table called tblCustomers with a field called CustomerBalance.

I have a form called "Form1" which has a button!

When I click on the button I want to display the result of "Select count(*) from tblCustomers where CustomerBalance > 0".

The result should be displayed via a msgbox.

I know this is easy but how do I do it??
0
Comment
Question by:Patrick O'Dea
  • 2
3 Comments
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 39847712
You could use DCount:

MsgBox "Count: " & DCount("*", "tblCustomers", "CustomerBalance > 0") & "."

/gustav
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 39847795
Thanks Gustav,

I had forgotten about DCount!
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 39847812
You are welcome!

/gustav
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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…

773 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