View Full Version : Making Things VISIBLE IF ELSEIF


GOrDySHEDHEAD
07-03-2007, 02:46 AM
Hello,

I have a problem, Basically i want to make label boxes visible or invisable depending on data from a number of tick boxes.

I open a report (based on a query)
I enter the parameter value
I have TWO(2) tick boxes (named, PC, MC)
Based on earlier data entry i want certain labels to appear:

In the On Event of the report i choose Activate and the following code has been used:

Private Sub Report_Activate()

If [PC] And [MC] = YES Then
[LBLSYSTEMC].Visible = True
[LBLPUMPC].Visible = False
[LBLMATTC].Visible = False
[LBLNOC].Visible = False

ElseIf [PC] = YES And [MC] = NO Then
[LBLSYSTEMC].Visible = False
[LBLPUMPC].Visible = True
[LBLMATTC].Visible = False
[LBLNOC].Visible = False

ElseIf [PC] = NO And [MC] = YES Then
[LBLSYSTEMC].Visible = False
[LBLPUMPC].Visible = False
[LBLMATTC].Visible = True
[LBLNOC].Visible = False

ElseIf [PC] = NO And [MC] = NO Then
[LBLSYSTEMC].Visible = False
[LBLPUMPC].Visible = False
[LBLMATTC].Visible = False
[LBLNOC].Visible = True

End If

End Sub

The problem is the code does not seem to be working, no errors show, and it seems to me like the code is none existant.

Any Help would be appreciated

Rich
07-03-2007, 02:53 AM
Use the OnDetail format event

GOrDySHEDHEAD
07-03-2007, 03:07 AM
Thanks for that i knew it would be that simple.

Some labels are now visible and invisible, but the wrong one is being displayed

I have MC unticked which should display [LBLMATTC]

BUT

instead the label visible is [LBLSYSTEMC]

Any clues to why this is,

Again help is appreciated

GOrDySHEDHEAD
07-03-2007, 03:09 AM
I need to correct the line:

I have MC unticked which should display [LBLMATTC]

TO...

I have MC unticked which should display [LBLPUMPC]