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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

swapping subforms - general protection error

Status
Not open for further replies.

MadJock

Programmer
May 25, 2001
318
GB
Folks,

This driving me mad, any help would be appreciated.

I have a form that is unlinked to any tables or queries. It houses 2 subforms, each of which is based on a query. On load, each sub form checks to see if any records are returned by the query. If not, it will instead display another form in the subform showing the text "No Data"

The code for this is as follows (placed in the onload event of each subform):
Code:
if me.recordsetClone.recordCount <1 then
  forms!frmParentForm!subFormA.SourceObject = frmNoData
end if

So far this all works fine. The problem arises whn the close button is clicked on the master form. A general protection fault is produced.

The error only occurs if one or both of the subforms has swapped to the 'No Data' form.

Non of the forms (master, sub or otherwise) have any code that runs on close, unLoad etc.)

All I want to do is close the master form .... HELP

Thanks in advance,

Graeme
website:
 
Without seeing your database it's a little hard....but maybe instead of having that 3rd subform (the no data form), you could just create a field on your main form with default text of &quot;No Data&quot; and visible set to no. Then if there is no data for your other two subforms you could set their visible property to &quot;No&quot; and the field on your main form to &quot;yes&quot;.

Just a thought.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top