MassageBox

  • Thread starter Achit via AccessMonster.com
  • Start date
A

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????
 
W

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
 
L

Larry Linson

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 said:
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 said:
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????

--



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top