Show empty fields on subform rather than blank subform when no records are associated











up vote
0
down vote

favorite












I am using a subform on my main contact form to display address data. I have a field on the subform that concatenates the values of all the constituent parts of the address- attn line, street and number, city, region, etc. This just makes it easy to view, but edits or additions take place through a popup form with separate fields for each of these parts of the address. I would like the subform to look the same whether or not any addresses have been added for that contact, but when the query to get the addresses for one contact has no results, the subform is totally blank. I'm looking for a way to let a blank field display before an address is added, and keep my labels visible as well.



I tried adding a rectangle of the same size and format as my text box control, then putting that behind the text box, but even with the rectangle, my subform is totally blank when no addresses have been entered. It is a blank box of just the subform background color- no rectangles, no labels, nothing.



The subform is set with the control source as a query that finds the address records for the contact ID that corresponds to the main form.










share|improve this question













migrated from dba.stackexchange.com Nov 7 at 8:38


This question came from our site for database professionals who wish to improve their database skills and learn from others in the community.















  • You mention the pop-up for editing the address data, but is the entire subform read-only (e.g. all controls are locked)? I suppose from the description that the subform also does not allow new records. Correct?
    – C Perkins
    Nov 8 at 3:58










  • Correct, the subform itself is enabled but the controls within the subform are not, with the exception of the add/edit command buttons. The subform does not allow new records, but if a user adds a new record via the popup, it will appear in the subform when the popup form closes (I requery the subform.)
    – Elizabeth Ham
    Nov 8 at 13:46















up vote
0
down vote

favorite












I am using a subform on my main contact form to display address data. I have a field on the subform that concatenates the values of all the constituent parts of the address- attn line, street and number, city, region, etc. This just makes it easy to view, but edits or additions take place through a popup form with separate fields for each of these parts of the address. I would like the subform to look the same whether or not any addresses have been added for that contact, but when the query to get the addresses for one contact has no results, the subform is totally blank. I'm looking for a way to let a blank field display before an address is added, and keep my labels visible as well.



I tried adding a rectangle of the same size and format as my text box control, then putting that behind the text box, but even with the rectangle, my subform is totally blank when no addresses have been entered. It is a blank box of just the subform background color- no rectangles, no labels, nothing.



The subform is set with the control source as a query that finds the address records for the contact ID that corresponds to the main form.










share|improve this question













migrated from dba.stackexchange.com Nov 7 at 8:38


This question came from our site for database professionals who wish to improve their database skills and learn from others in the community.















  • You mention the pop-up for editing the address data, but is the entire subform read-only (e.g. all controls are locked)? I suppose from the description that the subform also does not allow new records. Correct?
    – C Perkins
    Nov 8 at 3:58










  • Correct, the subform itself is enabled but the controls within the subform are not, with the exception of the add/edit command buttons. The subform does not allow new records, but if a user adds a new record via the popup, it will appear in the subform when the popup form closes (I requery the subform.)
    – Elizabeth Ham
    Nov 8 at 13:46













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am using a subform on my main contact form to display address data. I have a field on the subform that concatenates the values of all the constituent parts of the address- attn line, street and number, city, region, etc. This just makes it easy to view, but edits or additions take place through a popup form with separate fields for each of these parts of the address. I would like the subform to look the same whether or not any addresses have been added for that contact, but when the query to get the addresses for one contact has no results, the subform is totally blank. I'm looking for a way to let a blank field display before an address is added, and keep my labels visible as well.



I tried adding a rectangle of the same size and format as my text box control, then putting that behind the text box, but even with the rectangle, my subform is totally blank when no addresses have been entered. It is a blank box of just the subform background color- no rectangles, no labels, nothing.



The subform is set with the control source as a query that finds the address records for the contact ID that corresponds to the main form.










share|improve this question













I am using a subform on my main contact form to display address data. I have a field on the subform that concatenates the values of all the constituent parts of the address- attn line, street and number, city, region, etc. This just makes it easy to view, but edits or additions take place through a popup form with separate fields for each of these parts of the address. I would like the subform to look the same whether or not any addresses have been added for that contact, but when the query to get the addresses for one contact has no results, the subform is totally blank. I'm looking for a way to let a blank field display before an address is added, and keep my labels visible as well.



I tried adding a rectangle of the same size and format as my text box control, then putting that behind the text box, but even with the rectangle, my subform is totally blank when no addresses have been entered. It is a blank box of just the subform background color- no rectangles, no labels, nothing.



The subform is set with the control source as a query that finds the address records for the contact ID that corresponds to the main form.







ms-access ms-access-2016






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 6 at 20:41









Elizabeth Ham

1139




1139




migrated from dba.stackexchange.com Nov 7 at 8:38


This question came from our site for database professionals who wish to improve their database skills and learn from others in the community.






migrated from dba.stackexchange.com Nov 7 at 8:38


This question came from our site for database professionals who wish to improve their database skills and learn from others in the community.














  • You mention the pop-up for editing the address data, but is the entire subform read-only (e.g. all controls are locked)? I suppose from the description that the subform also does not allow new records. Correct?
    – C Perkins
    Nov 8 at 3:58










  • Correct, the subform itself is enabled but the controls within the subform are not, with the exception of the add/edit command buttons. The subform does not allow new records, but if a user adds a new record via the popup, it will appear in the subform when the popup form closes (I requery the subform.)
    – Elizabeth Ham
    Nov 8 at 13:46


















  • You mention the pop-up for editing the address data, but is the entire subform read-only (e.g. all controls are locked)? I suppose from the description that the subform also does not allow new records. Correct?
    – C Perkins
    Nov 8 at 3:58










  • Correct, the subform itself is enabled but the controls within the subform are not, with the exception of the add/edit command buttons. The subform does not allow new records, but if a user adds a new record via the popup, it will appear in the subform when the popup form closes (I requery the subform.)
    – Elizabeth Ham
    Nov 8 at 13:46
















You mention the pop-up for editing the address data, but is the entire subform read-only (e.g. all controls are locked)? I suppose from the description that the subform also does not allow new records. Correct?
– C Perkins
Nov 8 at 3:58




You mention the pop-up for editing the address data, but is the entire subform read-only (e.g. all controls are locked)? I suppose from the description that the subform also does not allow new records. Correct?
– C Perkins
Nov 8 at 3:58












Correct, the subform itself is enabled but the controls within the subform are not, with the exception of the add/edit command buttons. The subform does not allow new records, but if a user adds a new record via the popup, it will appear in the subform when the popup form closes (I requery the subform.)
– Elizabeth Ham
Nov 8 at 13:46




Correct, the subform itself is enabled but the controls within the subform are not, with the exception of the add/edit command buttons. The subform does not allow new records, but if a user adds a new record via the popup, it will appear in the subform when the popup form closes (I requery the subform.)
– Elizabeth Ham
Nov 8 at 13:46












1 Answer
1






active

oldest

votes

















up vote
1
down vote













Probably the easiest solution is to use the form header for the subform:




  1. Right click on the Form in Design View and select "Form Header/Footer". Both a footer and header section will be displayed.

  2. Move all form controls to the header. This can be done en masse by selecting all controls and dragging them to the header.

  3. For both the Detail and Footer sections, set Visible to False. Optionally collapse the sections to take no vertical space.


That's it. The header remains always visible, including the controls. When the recordset is empty, the controls can still obtain focus but don't allow key presses, etc. Buttons and other action controls remain enabled.



As long as the subform only displays one record at a time, the bound controls in the header will behave as expected for each individual row.





Caveat



Because the described behavior (namely, the form detail section is hidden for an empty recordset when AllowAdditions is set to False) is inherent to an Access form, any solution will involve workarounds that likely will change normal, expected behavior of the subform. Resolutions may exist to any such adverse behavior, but will require more extensive handling using form events and additional programming. This solution doesn't cover all such conditions.



For instance, the given solution will not work for a continuous or datasheet subform since the header is NOT repeated for each row. Also, the header will not resize automatically even if the form properties are set to automatically shrink or grow. Proper handling of Resize events may fix this, but it will involve handling not only the subform events, but also the parent form's events to properly resolve that issue.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185911%2fshow-empty-fields-on-subform-rather-than-blank-subform-when-no-records-are-assoc%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    Probably the easiest solution is to use the form header for the subform:




    1. Right click on the Form in Design View and select "Form Header/Footer". Both a footer and header section will be displayed.

    2. Move all form controls to the header. This can be done en masse by selecting all controls and dragging them to the header.

    3. For both the Detail and Footer sections, set Visible to False. Optionally collapse the sections to take no vertical space.


    That's it. The header remains always visible, including the controls. When the recordset is empty, the controls can still obtain focus but don't allow key presses, etc. Buttons and other action controls remain enabled.



    As long as the subform only displays one record at a time, the bound controls in the header will behave as expected for each individual row.





    Caveat



    Because the described behavior (namely, the form detail section is hidden for an empty recordset when AllowAdditions is set to False) is inherent to an Access form, any solution will involve workarounds that likely will change normal, expected behavior of the subform. Resolutions may exist to any such adverse behavior, but will require more extensive handling using form events and additional programming. This solution doesn't cover all such conditions.



    For instance, the given solution will not work for a continuous or datasheet subform since the header is NOT repeated for each row. Also, the header will not resize automatically even if the form properties are set to automatically shrink or grow. Proper handling of Resize events may fix this, but it will involve handling not only the subform events, but also the parent form's events to properly resolve that issue.






    share|improve this answer



























      up vote
      1
      down vote













      Probably the easiest solution is to use the form header for the subform:




      1. Right click on the Form in Design View and select "Form Header/Footer". Both a footer and header section will be displayed.

      2. Move all form controls to the header. This can be done en masse by selecting all controls and dragging them to the header.

      3. For both the Detail and Footer sections, set Visible to False. Optionally collapse the sections to take no vertical space.


      That's it. The header remains always visible, including the controls. When the recordset is empty, the controls can still obtain focus but don't allow key presses, etc. Buttons and other action controls remain enabled.



      As long as the subform only displays one record at a time, the bound controls in the header will behave as expected for each individual row.





      Caveat



      Because the described behavior (namely, the form detail section is hidden for an empty recordset when AllowAdditions is set to False) is inherent to an Access form, any solution will involve workarounds that likely will change normal, expected behavior of the subform. Resolutions may exist to any such adverse behavior, but will require more extensive handling using form events and additional programming. This solution doesn't cover all such conditions.



      For instance, the given solution will not work for a continuous or datasheet subform since the header is NOT repeated for each row. Also, the header will not resize automatically even if the form properties are set to automatically shrink or grow. Proper handling of Resize events may fix this, but it will involve handling not only the subform events, but also the parent form's events to properly resolve that issue.






      share|improve this answer

























        up vote
        1
        down vote










        up vote
        1
        down vote









        Probably the easiest solution is to use the form header for the subform:




        1. Right click on the Form in Design View and select "Form Header/Footer". Both a footer and header section will be displayed.

        2. Move all form controls to the header. This can be done en masse by selecting all controls and dragging them to the header.

        3. For both the Detail and Footer sections, set Visible to False. Optionally collapse the sections to take no vertical space.


        That's it. The header remains always visible, including the controls. When the recordset is empty, the controls can still obtain focus but don't allow key presses, etc. Buttons and other action controls remain enabled.



        As long as the subform only displays one record at a time, the bound controls in the header will behave as expected for each individual row.





        Caveat



        Because the described behavior (namely, the form detail section is hidden for an empty recordset when AllowAdditions is set to False) is inherent to an Access form, any solution will involve workarounds that likely will change normal, expected behavior of the subform. Resolutions may exist to any such adverse behavior, but will require more extensive handling using form events and additional programming. This solution doesn't cover all such conditions.



        For instance, the given solution will not work for a continuous or datasheet subform since the header is NOT repeated for each row. Also, the header will not resize automatically even if the form properties are set to automatically shrink or grow. Proper handling of Resize events may fix this, but it will involve handling not only the subform events, but also the parent form's events to properly resolve that issue.






        share|improve this answer














        Probably the easiest solution is to use the form header for the subform:




        1. Right click on the Form in Design View and select "Form Header/Footer". Both a footer and header section will be displayed.

        2. Move all form controls to the header. This can be done en masse by selecting all controls and dragging them to the header.

        3. For both the Detail and Footer sections, set Visible to False. Optionally collapse the sections to take no vertical space.


        That's it. The header remains always visible, including the controls. When the recordset is empty, the controls can still obtain focus but don't allow key presses, etc. Buttons and other action controls remain enabled.



        As long as the subform only displays one record at a time, the bound controls in the header will behave as expected for each individual row.





        Caveat



        Because the described behavior (namely, the form detail section is hidden for an empty recordset when AllowAdditions is set to False) is inherent to an Access form, any solution will involve workarounds that likely will change normal, expected behavior of the subform. Resolutions may exist to any such adverse behavior, but will require more extensive handling using form events and additional programming. This solution doesn't cover all such conditions.



        For instance, the given solution will not work for a continuous or datasheet subform since the header is NOT repeated for each row. Also, the header will not resize automatically even if the form properties are set to automatically shrink or grow. Proper handling of Resize events may fix this, but it will involve handling not only the subform events, but also the parent form's events to properly resolve that issue.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 8 at 19:34

























        answered Nov 8 at 16:34









        C Perkins

        1,73511321




        1,73511321






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185911%2fshow-empty-fields-on-subform-rather-than-blank-subform-when-no-records-are-assoc%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Schultheiß

            Liste der Kulturdenkmale in Wilsdruff

            Android Play Services Check