Solved

Displaying the result of SQL in msgbox

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

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 50

Expert Comment

by:Gustav Brock
ID: 39847812
You are welcome!

/gustav
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

707 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