HasData on a form?

O

Opal

I am running Access 2003 and have
a subform based on a query. I have
a textbox on the main form that shows
the value in one of the textboxes on the
subform. If the query has no records,
I get #Error in my textbox on the main
form. How can I get the text box on
the main form to show zero if the query
has no records on the subform?
 
R

roger

1st unbind the text box
then after the query
use

If Me.MySubform.Form.Recordset.RecordCount < 1 Then
me.MyTextBox= "No Records Found"
else
me.MyTextBox= [whatever it does now]
End If

to update the textbox
 
D

Dirk Goldgar

Opal said:
I am running Access 2003 and have
a subform based on a query. I have
a textbox on the main form that shows
the value in one of the textboxes on the
subform. If the query has no records,
I get #Error in my textbox on the main
form. How can I get the text box on
the main form to show zero if the query
has no records on the subform?


Keri Hardwick has posted a nice solution:

http://www.mvps.org/access/forms/frm0022.htm
Forms: #Error when the Subform has no records
 

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