Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Displaying the result of SQL in msgbox

Posted on 2014-02-10
3
Medium Priority
?
613 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Gustav Brock earned 2000 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 52

Expert Comment

by:Gustav Brock
ID: 39847812
You are welcome!

/gustav
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

609 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