Discussion:
MassageBox
(too old to reply)
Achit via AccessMonster.com
2010-05-23 07:39:15 UTC
Permalink
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
Wayne-I-M
2010-05-23 17:26:04 UTC
Permalink
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.
Post by Achit via AccessMonster.com
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
.
Larry Linson
2010-05-24 19:24:47 UTC
Permalink
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
Post by Wayne-I-M
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.
Post by Achit via AccessMonster.com
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
.
adrianna billings
2010-05-27 21:14:36 UTC
Permalink
Have you ever had sex it feels good.
Loading...