If Query returns empty display a certain records instead on being empty 
Author Message
 If Query returns empty display a certain records instead on being empty

Is there a was to have a query do it's thing and if it comes up with no
records show me one certain record that would never change.  I Have a query
telling everyone problems with our network.  When there is nothing wrong I
want to query to come up with a record that says everything is fine.


Thanks in Advance
Colin



Sun, 28 Jan 2001 03:00:00 GMT  
 If Query returns empty display a certain records instead on being empty
Try using code: Write a query that performs a count on your "real" query.
When it returns 0, then pop up a msgbox and do not open your "real" query.

Sub ....
 Dim dbs As Database, rst As Recordset
  Set dbs = CurrentDb()
  Set rst = dbs.OpenRecordset("Count of yourquery", dbOpenDynaset)
  If rst![Number Of Records] = 0 Then
    MsgBox ("No problems with the network.")
    rst.Close
    Set dbs = Nothing
    Exit Sub
  End If

  DoCmd.OpenQuery "yourquery"
EndSub

Joe

Quote:

>Is there a was to have a query do it's thing and if it comes up with no
>records show me one certain record that would never change.  I Have a query
>telling everyone problems with our network.  When there is nothing wrong I
>want to query to come up with a record that says everything is fine.


>Thanks in Advance
>Colin



Tue, 30 Jan 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Displaying the 3rd cell from the last non-empty empty cell

2. If Subreport is empty, Display text box saying so instead

3. Forcing pivot table cell to display 0 instead of null(empty data)

4. If Subreport is empty, Display text box saying so instead

5. Empty records should not be empty spaces/lines!

6. Same query gives empty records from access and 14 records from Sybase11

7. HELP: Query returns only ONE empty field

8. Query Return Empty

9. Agregate function returns null on empty query?

10. Query returns empty recordset


 
Powered by phpBB® Forum Software © phpBB Group