Answered by:
Empty Subform Not Showing

Question
-
The subform I have created will only show once it has information in it.
It has the right links to parent and I made the child ID's have a default valve which I have done before and it all worked. I have tried without in case this was upsetting it.
The subform allows edits etc.
It is based on a query and in a tab but I've made it work before but don't remember having this trouble.
Friday, October 23, 2015 12:41 PM
Answers
-
Yes this is normal behavior if the sub form is not allowing additions. That is an option in the form's property. You could change that property to Allow Additions - - however that may not be something you want the user to be able to do.
So you can educate users as to why it is blank. You could get creative and force in a single dummy record. You could toggle a label that says "No Data Available".
- Proposed as answer by Edward8520Microsoft contingent staff Monday, October 26, 2015 1:25 AM
- Marked as answer by Edward8520Microsoft contingent staff Monday, November 2, 2015 6:55 AM
Friday, October 23, 2015 12:51 PM
All replies
-
Yes this is normal behavior if the sub form is not allowing additions. That is an option in the form's property. You could change that property to Allow Additions - - however that may not be something you want the user to be able to do.
So you can educate users as to why it is blank. You could get creative and force in a single dummy record. You could toggle a label that says "No Data Available".
- Proposed as answer by Edward8520Microsoft contingent staff Monday, October 26, 2015 1:25 AM
- Marked as answer by Edward8520Microsoft contingent staff Monday, November 2, 2015 6:55 AM
Friday, October 23, 2015 12:51 PM -
As msdnPublicIdentity said, if the no records can be added on the subform, and there are no records to display, the subform will be blank. You mention that the subform allows edits. Does it allow additions, as well? If it does, then possibly its recordsource query doesn't allow additions. For example, if it uses any of the SQL aggregate functions -- Sum(), Count(), Max(), etc. -- it will be non-updatable. There can be other reasons, as well, for a query being non-updatable. So open the recordsource query directly in datasheet view and see if it's updatable.
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.htmlFriday, October 23, 2015 5:49 PM -
If the problem is due to the subform's AllowAdditions property being False (No), and you do not want to allow a new row to be inserted via the subform, then change the property to True (Yes) put the following line of code in the subform's BeforeInsert event procedure:
Cancel = True
The empty subform will show, but the user will not be able to insert any data.
If the problem is a non-updatable RecordSource then you'll need to change the query so that it is updatable. If you can post the subform's current query's SQL statement, we might be able to advise further.
Ken Sheridan, Stafford, England
- Edited by Ken Sheridan Saturday, October 24, 2015 12:01 PM For clarity.
Saturday, October 24, 2015 11:59 AM