//flex table opened by JP

Click to See Complete Forum and Search --> : Access filtering of null values


Spardan
08-23-2004, 07:51 AM
Hi guys... Not sure that this is possible, but...

Currently building a DB that has a number of checkbox options, any number of which (0-all) can be selected. Anyone know of a way I can compile a report that will omit any unselected (ie NULL) values without skipping the entire record?

To be a bit clearer, if there are 10 options, and 3 have been selected, it's only those 3 I want to appear on the report, rather than the entire list. Any ideas at all would be appreciated.. I've googled and got nowhere.. (I say that in the hope that some bright spark will now point me straight to a google search string and flame me... I'll take that right now, believe me :D)

DocEvi1
08-23-2004, 11:54 AM
you need a macro AFAIK, Access can't do it itself.

ScaryBinary
08-23-2004, 01:07 PM
I can think of a few ways to do this. One way would be to hide/show the checkboxes, based on their checked values, using Visual Basic. In your report, you'd need to add a Detail_Format event. Something like the following:Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Check1.Visible = Me.Check1
Me.Check2.Visible = Me.Check2
Me.Check3.Visible = Me.Check3
End Sub
When the report is rendered, this code will be called, and each checkbox would be hidden if it is not checked and shown if it is checked. You may need to arrange your checkboxes and set the "canshrink" property of the Detail section to make it a little prettier (otherwise you may end up with a bunch of white space if few items are checked). I think that will work.

The other option might be to use a subreport for the checkbox fields (even if they're in the same table). That way, you can filter the checkboxes in the subreport (to show only "True" values for each record) but still display the main record even if no items are checked.

Hope that makes sense. Let me know if you need the nitty-gritty details and I'll try to whip something up when I have more time.

Spardan
08-24-2004, 07:00 AM
Thanks guys... interesting stuff, which I'll bear in mind for the future... I figured that access somehow wasn't quite equipped itself to meet such demanding (!) requirements... :D