No Results Message

FREDDY67

Registered User.
Local time
Today, 14:50
Joined
Apr 23, 2007
Messages
52
Morning
I have a label in a form with the 'visible' property set to 'No', I am trying to display the label when the query returns no results & the form is blank. The code I am using is as follows;

Private Sub Form_Open(Cancel As Integer)
Dim rs As Object
Set rs = Me.RecordsetClone
If rs.RecordCount = 0 Then
ApptMemo.Visible = False
lblNa.Visible = True
End If
Set rs = Nothing
End Sub

If I set the 'RecordCount < 2', the form displays the label as required, but I need it to display at '0' or '< 1', is this possible.

Many Thanks

Freddy
 
Not possible. Non of the form is displayed if there is no data to display...
Instead us a popup or perhaps stick the hidden label in the header or footer of the form. I think that is displayed...
 
namliam

Many thanks for your swift reply, I created a duplicate form with just the label on it & this opens perfectly & displays the message.

Private Sub Form_Open(Cancel As Integer)
Dim rs As Object
Set rs = Me.RecordsetClone
If rs.RecordCount = 0 Then
DoCmd.OpenForm "frmApptMemo1"
DoCmd.Close acForm, "frmApptMemo"
End If
Set rs = Nothing
End Sub

Cheers

Freddy
 
Have you linked it to a query that doesnt return anything??
 

Users who are viewing this thread

Back
Top Bottom