Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No Data in form

Status
Not open for further replies.

andrep

Technical User
Feb 27, 2002
40
CA
I have a form based on a query that returns only those records that have a balance !

Now if no records match the form opens with no fields or
controls ?

Since there is no event for onnodata for forms how can i
handle this situation to tell the user that there are no
records to be edited ???????

Thanks in advance
Andre
 
On the form's load event, check to see if there are any records behind it. If NOT, you might need to make a control VISIBLE and tell the user that.

Sub Form_Load()
if DCount("*", ME.Recordsource) = 0 then
Me.WarningBox.visible = true
else
end if
End sub

There may be other more efficient ways of seeing if there are any records there too - such as trying to issue a MOVEFIRST command or something. If MOVEFIRST generates an error, you know there aren't any records.



Remember, you're unique - just like everyone else
You're invited to visit another free Access forum:
or my site,
 
Thanks that did the trick!
Just needed to provoque an error so that i could provide
a msgbox !

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top