Forum Discussion

bltsr's avatar
bltsr
Copper Contributor
Sep 29, 2020

Hide empty cell

Hello everyone,

I have created a form that lists company files. Each company has its own form and each form contains a sub-form.

In the sub-form, I created several lines containing one country per line and in the same sub-form the columns ( around ten) are data.

However, it happens that for some companies there is no data for some columns, which implies that column remains empty.  

Thus, imagine a sub-form for a company can have 3 columns: one with the name of the country, one with the country’s GDP and one with the country’s political risk. There are countries for which the GDP information is available but for others it is not the case. So, whether GDP cell is empty in all the lines, I would like to hide this column and leave only the columns which contains data.

The question is:

=> Is it possible to display the columns automatically whether the cell is empty?

In fact, I want the form columns that have no data to be hidden, but I can't make a filter in the request columns because otherwise it applies for all lines, and the data available is not the same for all of them.

 

I hope it’s clear enough and you’ll can help me !

  • Woldman's avatar
    Woldman
    Iron Contributor

    bltsr 

    I made an example Access-file that has an implementation of the functionality you sketched, but I can't drop this file as an attachment here. Maybe you could provide an email address where I can send it to.

     

    It uses a small piece of VBA-code to hide/show the GDP whether being empty or not. Maybe you can elaborate on the example.

     

    Best wishes,

    Tieme

    • bltsr's avatar
      bltsr
      Copper Contributor

      Woldman Thanks for your answer ! Indeed, it could be very useful ! I'll send you a private message to give you my mail address. 

       

  • George_Hepworth's avatar
    George_Hepworth
    Silver Contributor

    bltsr May I suggest an alternative that wouldn't require manipulating controls in a form?

    Rather than trying to show or hide them, why not DISPLAY a default value like "N/A" for those records where the value is not available. That's a POSITIVE way to convey the information, as opposed to the PASSIVE approach.

    • bltsr's avatar
      bltsr
      Copper Contributor

      George_Hepworth Thank you for your answer and this alternative ! I'll try it if I can't find something else, but it can be a really good solution !

      Have a nice day

Resources