Empty Subform

  • Thread starter Thread starter Steve Marsden
  • Start date Start date
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
 
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
 
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? :-)
 
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
 
Back
Top