Go Back   Access World Forums > Microsoft Access Discussion > Reports

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-04-2004, 08:10 PM   #1
shrndegruv
Registered User
 
Join Date: Sep 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
shrndegruv is on a distinguished road
displaying only true/false values that are true

Hi all

I have a form that has twenty True/False items. Rather than display all of them for each record in the DB, how can I show only the ones that are True?

Do I need VB for this? I hope not, but it seems that we can either put the value on the report or not, regardless of true/false...

Thanx in advance.

shrndegruv is offline   Reply With Quote
Old 11-04-2004, 09:59 PM   #2
john471
Newly Registered User
 
john471's Avatar
 
Join Date: Sep 2004
Location: And the winner is... Syd-a-knee
Posts: 392
Thanks: 0
Thanked 0 Times in 0 Posts
john471 is on a distinguished road
I don't know how you would do this without VB.....

With VB... quite simple !

Assuming :-
*Your form view is Single Form (won't work well at all with "continuous forms")
*You are using checkboxes to display your true/false values, you always want to show them when the bound value is true, and always want to hide them when the bound value is false
*The checkboxes you want to apply this logic to are all named with the same pre-fix e.g. "chk"

If the above assumptions don't hold... you'll need to give more details.

If the above assumptions do hold... set code similar to the following for the Form's OnCurrent event

Code:
Private Sub Form_Current()
    On Error Resume Next
    Dim ctl As Control
    For Each ctl In Me.Controls
        If ctl.Name Like "chk*" Then
            ctl.Visible = ctl.Value
        End If
    Next
    Set ctl = Nothing
End Sub
Now that I've written this, I think I've mis-interpreted your question; given that this is the "reports" forum, and not the "forms" forum. I was going to delete it, but I'll leave it here in case it is helpful.
__________________
And as I always like to say...
"Half a proverb is better than."

Last edited by john471; 11-04-2004 at 10:03 PM.
john471 is offline   Reply With Quote
Old 11-05-2004, 12:04 AM   #3
Rich
Guest
 
Posts: n/a
In the Reports underlying Query, put True in the criteria section of your field

  Reply With Quote
Old 11-05-2004, 07:21 AM   #4
shrndegruv
Registered User
 
Join Date: Sep 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
shrndegruv is on a distinguished road
very cute rich. But that only affect which records are selected, not which fields are displayed on the report.
shrndegruv is offline   Reply With Quote
Old 11-05-2004, 08:49 PM   #5
WayneRyan
AWF VIP
 
Join Date: Nov 2002
Location: Camarillo, CA
Posts: 7,090
Thanks: 6
Thanked 57 Times in 55 Posts
WayneRyan is a jewel in the rough WayneRyan is a jewel in the rough WayneRyan is a jewel in the rough
s,

You can use the DetailFormat event:

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim i As Integer
For i = 0 To Me.Controls.Count - 1
   If Me.Controls(i).ControlType = acCheckBox Then
      If Me.Controls(i) Then
         Me.Controls(i).Visible = True
      Else
         Me.Controls(i).Visible = False
      End If
   End If
   Next i
End Sub
Wayne
WayneRyan is offline   Reply With Quote
Old 11-06-2004, 05:18 PM   #6
shrndegruv
Registered User
 
Join Date: Sep 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
shrndegruv is on a distinguished road
Wayne

thanx that makes some sense. Question: I still have to put the checkboxes on the report -- if one is not visible, is there a space where it is, or does the next visible one take its place? Does that make any sense?

mike
shrndegruv is offline   Reply With Quote
Old 11-06-2004, 05:57 PM   #7
WayneRyan
AWF VIP
 
Join Date: Nov 2002
Location: Camarillo, CA
Posts: 7,090
Thanks: 6
Thanked 57 Times in 55 Posts
WayneRyan is a jewel in the rough WayneRyan is a jewel in the rough WayneRyan is a jewel in the rough
Mike,

Yes, that makes sense.

The code just makes them invisible. Their space is still occupied by the
invisible control. You could experiment with Me.YourCheckBox.Left = 1500.
You can move them around, but I don't think it would be worth it.

A nice thing (and easy to try) would be to investigate the color of the
checkboxes.

Me.YourCheckBox.ForeColor & Me.YourCheckBox.BackColor might be nice.
Instead of making them invisible, make them some very light color. They
would still be there for perspective, but the checked ones would really
stand out.

Wayne

WayneRyan is offline   Reply With Quote
Old 11-08-2004, 09:55 AM   #8
shrndegruv
Registered User
 
Join Date: Sep 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
shrndegruv is on a distinguished road
Wayne

in this case there are so many checkboxes that the report would be ridiculously long if I have to place all of them.

Fortuneately, in this case it makes sense conceptually to divide this report into three reports, limiting the number of chboxes on each report.

It seems like MS needs to make this easier.

Thanx for your insight
m

shrndegruv is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump




All times are GMT -8. The time now is 08:34 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World