Empty Subform

S

Steve Marsden

I want to get a value from a field in a subform which works fine until the
subform contains no records and i then get a Run Time error "You have
entered an expression that has no value".


How can I prevent this error or detect my subform has no records
 
J

Jeremiah Ellison

I want to get a value from a field in a subform which works fine until the
subform contains no records and i then get a Run Time error "You have
entered an expression that has no value".


How can I prevent this error or detect my subform has no records

The only way I know of checking to see if a form has no records is to check the EOF and BOF properties of the form's
recordset. Out of the help file for MS VB...
"If either the BOF or EOF property is True, there is no current record."
I believe you get that error if either is true. However, if you wish to specificly check that there are no records, both will
be true in that case. In forms, the BOF and EOF properties apply to the RecordSetClone object.

(form).RecordSetClone.EOF

Jeremiah Ellison
Ellison Enterprises - Your One Stop IT Experts
 
B

Bruce M. Thompson

The only way I know of checking to see if a form has no records is to check
the EOF and BOF properties of the form's
recordset. Out of the help file for MS VB...
"If either the BOF or EOF property is True, there is no current record."
I believe you get that error if either is true. However, if you wish to
specificly check that there are no records, both will
be true in that case. In forms, the BOF and EOF properties apply to the RecordSetClone object.

(form).RecordSetClone.EOF

Jeremiah Ellison
Ellison Enterprises - Your One Stop IT Experts

You can also check the form's recordsetclone's "RecordCount" property:

forms("MyFormName").RecordsetClone.recordcount

Another Ellison? What relation to Tom? :)
 
J

Jeremiah Ellison

the EOF and BOF properties of the form's
specificly check that there are no records, both will

You can also check the form's recordsetclone's "RecordCount" property:

forms("MyFormName").RecordsetClone.recordcount

Another Ellison? What relation to Tom? :)
Yup, I guess I forget about that because I always do it the other way...
....sorry for the late reply, using some shareware that's trial period ran out and it's reduced features make it a bit of a
nuisance on newsgroups so I don't post much at the moment.

Yes, another Ellison :) I'm his son, heh.
Jeremiah Ellison
Ellison Enterprises - Your One Stop IT Experts
 

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