From: Achit via AccessMonster.com on
I create a program Audit Tools...and I want Make MassageBox if my subform
empty...I want make massagebox "No Data Found"...What Should I do????

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-gettingstarted/201005/1

From: Wayne-I-M on
Hi

You will be able to see if a subform has no records so I don't understand
why you would need a message popup also ???

But if you really want a popup then you'll need to count the records that
should go into the subform and if the answer is 0 then you have the massage
popup.

Something like this will do

Dim rsClone as Recordset
set rsClone =
Forms![YourMainFormName..]![YourSubformName..].Form.RecordsetClone
if rsClone.recordcount = 0 then
MsgBox "Hi, I don't have any records", vbInformation, "Subform has a problem"
end if
set rsClone = Nothing

Of course change
YourMainFormName and YourSubformName
to what they really are.

Hope this helps


--
Wayne
Manchester, England.



"Achit via AccessMonster.com" wrote:

> I create a program Audit Tools...and I want Make MassageBox if my subform
> empty...I want make massagebox "No Data Found"...What Should I do????
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-gettingstarted/201005/1
>
> .
>
From: Larry Linson on
Usually massages are done on a table or in a special chair, not in a box.
"Message Box", however, is almost universally understood when abbreviated as
"MsgBox".

If the OP really wants a MsgBox if there are no records to display in the
Subform, this code in the Load Event of the Form embedded in that Subform
Control should do the trick. If the OP is displaying a datasheet instead of
a form, he/she shouldn't be.

Private Sub Form_Load()
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "The Subform Has No Records"
End If
End Sub

--
Larry Linson, Microsoft Office Access MVP
Co-author: "Microsoft Access Small Business Solutions", published by Wiley
Access newsgroup support is alive and well in USENET
comp.databases.ms-access


"Wayne-I-M" <WayneIM(a)discussions.microsoft.com> wrote in message
news:87EADFD3-0817-4FB2-9127-2BF446636F39(a)microsoft.com...
> Hi
>
> You will be able to see if a subform has no records so I don't understand
> why you would need a message popup also ???
>
> But if you really want a popup then you'll need to count the records that
> should go into the subform and if the answer is 0 then you have the
> massage
> popup.
>
> Something like this will do
>
> Dim rsClone as Recordset
> set rsClone =
> Forms![YourMainFormName..]![YourSubformName..].Form.RecordsetClone
> if rsClone.recordcount = 0 then
> MsgBox "Hi, I don't have any records", vbInformation, "Subform has a
> problem"
> end if
> set rsClone = Nothing
>
> Of course change
> YourMainFormName and YourSubformName
> to what they really are.
>
> Hope this helps
>
>
> --
> Wayne
> Manchester, England.
>
>
>
> "Achit via AccessMonster.com" wrote:
>
>> I create a program Audit Tools...and I want Make MassageBox if my subform
>> empty...I want make massagebox "No Data Found"...What Should I do????
>>
>> --
>> Message posted via AccessMonster.com
>> http://www.accessmonster.com/Uwe/Forums.aspx/access-gettingstarted/201005/1
>>
>> .
>>