If no records in a subform display a label

Sam Summers

Registered User.
Local time
Today, 23:07
Joined
Sep 17, 2001
Messages
939
Hi,

I have a form with 3 subforms on it based on individual queries.

If there is no data to display the subforms are blank.

I want to display a Label on the subform saying that there is no data to display?

I have tried a few things but i am missing something somewhere?

Thank you in advance
 
How will this No Record scenario occur? You can create a Label by default saying "No Records, move along", then you can set it to visible based on the Subform.Recordcount > 0. This needs the SubForm to be anything other than Datasheet.
 
Thanks for that Paul.

I have now got this in the 'OnLoad' Event of the subform but nothing is happening?:

If Recordset.RecordCount > 0 Then
Me.Alert.Visible = True
 
No, try.
Code:
Me.Alert.Visible = Me.RecordsetClone.Recordcount <= 0
 
Still nothing happening?

I have this 'Alert' Label on the detail section of the subform in the same place where the data would be displayed when there is some.

I am just thinking that if there are no records to display then my 'Alert' wont either?

Another option would be to place the label on the main form and then make the subform not visible if no data?


I have to go to a meeting now but i'll be back later.
 
What is the SubForm view? Okay, if possible upload a Stripped DB to examine.
 
Thanks Paul,

It was as i said.

What i did in the end was place 'Alert' on the main form behind the Subform and created a box the same size and position as the Subform and then of course i had to change the code.
So this is what i used and it works fine:

Private Sub Form_Load()

If Me.RecordsetClone.RecordCount <= 0 Then
Forms!FMUtilizationFrm.Alert2.Visible = True
Forms!FMUtilizationFrm.Box8.Visible = True
Else
End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom