View Full Version : No Records "Message"


chuckster
07-12-2001, 03:14 PM
I have a "Continous Form" which displays data from a query. The form does not allow additions or deletes.

Sometimes there is no data to display and the form comes up blank which is fine but I would like to print a message on the screen either a messagebox or an unbound texttbox saying "No Messages. Lucky".

I cannot however trigger an event to do this. I cannot refer to any of the fields on the form as none appear. I have tried referring to certian fields isnull() or >0 etc but nothing happens as there is no field to compare it to.

Is there a way to say "qryMessages" if no records to display then messagebox?

Any Ideas?

Rich
07-12-2001, 03:20 PM
Form Open
If Me.RecordsetClone.RecordsetCount=0 Then
MsgBox "Etc"
DoCmd.Close
EndIf

jimbrooking
07-14-2001, 05:43 AM
You could also place a label on the form with Name lblNoData and Caption "No Messages. Lucky!". In the Form's OnOpen event write

Me.lblNoData.Visible = (DCount("AnyField","qryMessages") = 0)

[This message has been edited by jimbrooking (edited 07-14-2001).]

chuckster
07-14-2001, 07:32 AM
Thanks M8. I didn't have any luck with Rich's suggestion. It said that the method was unsupported? Probably my fault.

Thanks Jim your suggestion worked splendidly.

Chuckster