Show message box if no records in the form

Posted on 2004-11-08
Medium Priority
Last Modified: 2008-01-16
I have a form that I open with criteria so it is filtered.  I would like to have a message appear if there are no records to display.  How can I count the number of records when the form opens and then display a message if the number is 0?

Question by:beyondt
LVL 22

Expert Comment

by:Helena Marková
ID: 12530624
You can use
Select count(*) INTO <<your_variable>> from <<tables with your criteria>>
and display this your_variable in a message box.

In Oracle Forms it will be:
When-New-Form-Instance trigger :
  your_variable  PLS_INTEGER;
 Select count(*) INTO your_variable FROM ....;
 IF your_variable=0 THEN
   Message('There are no records there.');
   Message('There are no records there.');
LVL 26

Expert Comment

by:Alan Warren
ID: 12531598
Hi beyondt

if MS Access something like this may do.

Private Sub Form_Current()
  If Me.RecordsetClone.RecordCount = 0 Then
    MsgBox Me.RecordsetClone.RecordCount
  End If
End Sub


Accepted Solution

dragonfire123 earned 225 total points
ID: 12726566
Maybe it would help us understand the problem better if we knew how you're accessing the database, and what language (or platform) you're using to get at the data?

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

850 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