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

Tab control doesn't display when there are no records on the subforms on the tab control 1

Status
Not open for further replies.

PeterMAS

Technical User
Apr 3, 2012
18
GT
Windows 7, Access 2013 Preview
My db is very normalized so all data on my main form is on sub forms.

To prevent accidental creation of new records and speed up form loading, all the subform queries are restricted to the current records and therefore don't contain a new record (I create new records using popups).

When there is no record, the subforms don't display--which I expected. No problems: no record--no data to see.

The problem is that my subforms are on a tab control and that doesn't display either. The command button to add a new record is on the tab control and I prefer not to move the button to the header because it sits next to the subform that contains a listbox listing current records.

It's no good adding a dummy record because there can be no records to display on the form when there are records in the db.

I have inspected the properties of my main form, subforms, tab control, & tab pages ; but I can't spot anything. Searching on this gets no results.

Is this expected behaviour?

Thanks

Peter
 
I'd set the AllowAdditions property to True and then in the Dirty event procedure:
If Me.NewRecord Then Cancel = True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV, but the Allow Additions Property is already set to True.

I moved an unlinked subform that contained data from the header to the tab control and got an "Invalid reference to Form" error message which confirms the tab control isn't loading. I removed some restrictions on the main form query so that it showed a new record and the tab control loaded.

This means that the tab control doesn't load when the main form query returns no records and isn't updateable. There may be circumstances where this isn't true, but I don't have time to do more testing.

With my query now allowing new records, I will take your advice to use the Dirty event procedure:
If Me.NewRecord Then Cancel = True

Thank you

Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top