Solved

Displaying the result of SQL in msgbox

Posted on 2014-02-10
3
584 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

762 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now