Form to Subform - What if no data?

dewsbury

Registered User.
Local time
Today, 19:15
Joined
Jul 4, 2008
Messages
57
I have a simple one to one link from one form to another.
However, sometimes there will (correctly) be no record on the subform.


The problem is that if there is no record found then the screen displays a blank screen.

I would be better if something more elegant than a blank screen could be displayed.?
Perhaps, a MSGBOX indicating that no record was found.


How can I make the sub form more elegant when no record found?
 
you can try to create a recordsetclone and do a recordcount and if it returns 0 then you display your message box
 
I have found something like this to be useful, assuming DAO is used:

Dim rs as DAO.Recordset
Set rs = Me.sfSubForm.Form.RecordsetClone

Select Case rs.Recordcount
Case >= 1
' aLL ok
Case = 0
' Display message
Case rs.BOF=True and rs.EOF=True
' Display message
End Select

If the recordset is truly empty then BOF and EOF will both be true.
 

Users who are viewing this thread

Back
Top Bottom