Fields disappear due to code

  • Thread starter Thread starter John
  • Start date Start date
J

John

I have a report that is comprised of a number of performance measures. Some
measures are Yes/No responses while others are Numerator/Denominator
responses. I have the code (below) in the On print portion of the Detail
section of the report.

My problem is that once the event is triggered to make the fields not
visible, they stay that way regardless of the situation of the particular
measure. Say the first five measures are num/den based. They display fine.
Now assume measure six is a Yes/No measure, measures 7 and forward will not
display the numerator and denominator fields. All fields reside within the
Details section of the report.

Thanks in advance for your help.

----CODE----
If Me!DollarUnits = -1 Then
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 1].Format = "Currency"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 2].Format = "Currency"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 3].Format = "Currency"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 4].Format = "Currency"
Me![Total Of ResultNum].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 1].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 2].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 3].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 4].Format = "Currency"
Me![Total Of ResultDen].Format = "Currency"
Else
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 1].Format = "Standard"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 2].Format = "Standard"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 3].Format = "Standard"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 4].Format = "Standard"
Me![Total Of ResultNum].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 1].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 2].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 3].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 4].Format = "Standard"
Me![Total Of ResultDen].Format = "Standard"
End If
If Me!YesNo = -1 Then
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 1].Visible = False
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 2].Visible = False
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 3].Visible = False
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 4].Visible = False
Me![LineNumDen].Visible = False
Me![Numerator].Visible = False
Me![Denominator].Visible = False
Me![LineQ1].Visible = False
Me![LineQ2].Visible = False
Me![LineQ3].Visible = False
Me![LineQ4].Visible = False
Me![LineFYTD].Visible = False
Me![Total Of ResultNum].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 1].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 2].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 3].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 4].Visible = False
Me![Total Of ResultDen].Visible = False
End If
 
The first part of the code works because you have an "Else" section of the
code. You don't have any lines of code that sets any controls back to visible.

--
Duane Hookom
Microsoft Access MVP


John said:
I have a report that is comprised of a number of performance measures. Some
measures are Yes/No responses while others are Numerator/Denominator
responses. I have the code (below) in the On print portion of the Detail
section of the report.

My problem is that once the event is triggered to make the fields not
visible, they stay that way regardless of the situation of the particular
measure. Say the first five measures are num/den based. They display fine.
Now assume measure six is a Yes/No measure, measures 7 and forward will not
display the numerator and denominator fields. All fields reside within the
Details section of the report.

Thanks in advance for your help.

----CODE----
If Me!DollarUnits = -1 Then
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 1].Format = "Currency"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 2].Format = "Currency"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 3].Format = "Currency"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 4].Format = "Currency"
Me![Total Of ResultNum].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 1].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 2].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 3].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 4].Format = "Currency"
Me![Total Of ResultDen].Format = "Currency"
Else
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 1].Format = "Standard"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 2].Format = "Standard"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 3].Format = "Standard"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 4].Format = "Standard"
Me![Total Of ResultNum].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 1].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 2].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 3].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 4].Format = "Standard"
Me![Total Of ResultDen].Format = "Standard"
End If
If Me!YesNo = -1 Then
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 1].Visible = False
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 2].Visible = False
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 3].Visible = False
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 4].Visible = False
Me![LineNumDen].Visible = False
Me![Numerator].Visible = False
Me![Denominator].Visible = False
Me![LineQ1].Visible = False
Me![LineQ2].Visible = False
Me![LineQ3].Visible = False
Me![LineQ4].Visible = False
Me![LineFYTD].Visible = False
Me![Total Of ResultNum].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 1].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 2].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 3].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 4].Visible = False
Me![Total Of ResultDen].Visible = False
End If
 
Duane - Thanks for pointing that out. Correcting that fixed the issue.
--
qwerty


Duane Hookom said:
The first part of the code works because you have an "Else" section of the
code. You don't have any lines of code that sets any controls back to visible.

--
Duane Hookom
Microsoft Access MVP


John said:
I have a report that is comprised of a number of performance measures. Some
measures are Yes/No responses while others are Numerator/Denominator
responses. I have the code (below) in the On print portion of the Detail
section of the report.

My problem is that once the event is triggered to make the fields not
visible, they stay that way regardless of the situation of the particular
measure. Say the first five measures are num/den based. They display fine.
Now assume measure six is a Yes/No measure, measures 7 and forward will not
display the numerator and denominator fields. All fields reside within the
Details section of the report.

Thanks in advance for your help.

----CODE----
If Me!DollarUnits = -1 Then
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 1].Format = "Currency"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 2].Format = "Currency"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 3].Format = "Currency"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 4].Format = "Currency"
Me![Total Of ResultNum].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 1].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 2].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 3].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 4].Format = "Currency"
Me![Total Of ResultDen].Format = "Currency"
Else
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 1].Format = "Standard"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 2].Format = "Standard"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 3].Format = "Standard"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 4].Format = "Standard"
Me![Total Of ResultNum].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 1].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 2].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 3].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 4].Format = "Standard"
Me![Total Of ResultDen].Format = "Standard"
End If
If Me!YesNo = -1 Then
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 1].Visible = False
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 2].Visible = False
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 3].Visible = False
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 4].Visible = False
Me![LineNumDen].Visible = False
Me![Numerator].Visible = False
Me![Denominator].Visible = False
Me![LineQ1].Visible = False
Me![LineQ2].Visible = False
Me![LineQ3].Visible = False
Me![LineQ4].Visible = False
Me![LineFYTD].Visible = False
Me![Total Of ResultNum].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 1].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 2].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 3].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 4].Visible = False
Me![Total Of ResultDen].Visible = False
End If
 
For future reference - I added sections and noticed that the code stopped
working resulting in behaivor as before. This may or may not be related to
the sections but I moved the code to the 'On format' portion of the detail
and is is now working properly (again).
--
QWERTY


John said:
Duane - Thanks for pointing that out. Correcting that fixed the issue.
--
qwerty


Duane Hookom said:
The first part of the code works because you have an "Else" section of the
code. You don't have any lines of code that sets any controls back to visible.

--
Duane Hookom
Microsoft Access MVP


John said:
I have a report that is comprised of a number of performance measures. Some
measures are Yes/No responses while others are Numerator/Denominator
responses. I have the code (below) in the On print portion of the Detail
section of the report.

My problem is that once the event is triggered to make the fields not
visible, they stay that way regardless of the situation of the particular
measure. Say the first five measures are num/den based. They display fine.
Now assume measure six is a Yes/No measure, measures 7 and forward will not
display the numerator and denominator fields. All fields reside within the
Details section of the report.

Thanks in advance for your help.

----CODE----
If Me!DollarUnits = -1 Then
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 1].Format = "Currency"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 2].Format = "Currency"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 3].Format = "Currency"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 4].Format = "Currency"
Me![Total Of ResultNum].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 1].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 2].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 3].Format = "Currency"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 4].Format = "Currency"
Me![Total Of ResultDen].Format = "Currency"
Else
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 1].Format = "Standard"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 2].Format = "Standard"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 3].Format = "Standard"
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 4].Format = "Standard"
Me![Total Of ResultNum].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 1].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 2].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 3].Format = "Standard"
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 4].Format = "Standard"
Me![Total Of ResultDen].Format = "Standard"
End If
If Me!YesNo = -1 Then
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 1].Visible = False
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 2].Visible = False
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 3].Visible = False
Me![q_FYNN_AllNumByQtr_FY2008 Qtr 4].Visible = False
Me![LineNumDen].Visible = False
Me![Numerator].Visible = False
Me![Denominator].Visible = False
Me![LineQ1].Visible = False
Me![LineQ2].Visible = False
Me![LineQ3].Visible = False
Me![LineQ4].Visible = False
Me![LineFYTD].Visible = False
Me![Total Of ResultNum].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 1].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 2].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 3].Visible = False
Me![q_FYNN_AllDenByQtr_FY2008 Qtr 4].Visible = False
Me![Total Of ResultDen].Visible = False
End If
 
Back
Top