A family of Microsoft relational database management systems designed for ease of use.
I wouldn't use the word "delete" if I were you, unless you actually want data to be deleted from the table. If I understand you correctly, what you really want to do is only return those columns where that column is not null in the entire result set. If I'm wrong, disregard the rest of this post.
A SQL SELECT statement can only return a fixed set of columns, so there's no way to do this with a simple query alone. There are only two ways I can think of to do this, both requiring code to achieve the result:
- First query the table (behind the scenes) for the records matching the criteria, then examine those records to see which columns are Null in all records, and then build a new SELECT statement applying the same criteria, requesting just those columns for which were not all Null. Then stuff that SELECT statement into a stored query (DAO querydef) and open it as a datasheet.
- Go ahead and open a datasheet on a query that returns all the columns, but after doing so, use code to examine all the columns and hide those that are entirely Null. If the query returns a large number of records, this process may take noticeable time, so you'd probably want to hide the query datasheet initially (opening it hidden), and only make it visible when all columns have been examined, and hidden if necessary.
I would have to experiment to see which of these approaches worked fastest. It seems to me that option 1 could take advantage of any indexes on the table, while option 2 could not. On the other hand, option 2 may be simpler to implement.