Visible / non visible fields on report

G

Guest

Jeff Boyce MVP, put me onto a neat way of hiding or displaying fields on a
report, eg
If Forms!frmSpecialMakeResults![Frame108] = 2 Then
Me![Name3].Visible = False
End If
This is in the On Format of the report detail.
Is there a way to put this in a module because I have 12 reports which have
exactly the same coding.
CurtainMary
 
B

Brendan Reynolds

You could reduce that expression to one line ...

Me![Name3].Visible = (Forms!frmSpecialMakeResults![Frame108] <> 2)

You could put it into a public function in a standard module, but you will
have to add a line of code to each report to call the function, so it will
still take a minimum of one line of code per report, regardless of whether
you use the function or not. If you still want to use a function, it would
look something like this ...

Public Function MakeName3Visible() As Boolean
MakeName3Visible = (Forms!frmSpecialMakeResults![Frame108] <> 2)
End Function

And you would call it like so ...

Me![Name3].Visible = MakeName3Visible()
 
G

Guest

Brendan, thank you very much. In my case the 'normal' is visible so I would
use <>1.
CurtainMary

Brendan Reynolds said:
You could reduce that expression to one line ...

Me![Name3].Visible = (Forms!frmSpecialMakeResults![Frame108] <> 2)

You could put it into a public function in a standard module, but you will
have to add a line of code to each report to call the function, so it will
still take a minimum of one line of code per report, regardless of whether
you use the function or not. If you still want to use a function, it would
look something like this ...

Public Function MakeName3Visible() As Boolean
MakeName3Visible = (Forms!frmSpecialMakeResults![Frame108] <> 2)
End Function

And you would call it like so ...

Me![Name3].Visible = MakeName3Visible()

--
Brendan Reynolds
Access MVP


CurtainMary said:
Jeff Boyce MVP, put me onto a neat way of hiding or displaying fields on a
report, eg
If Forms!frmSpecialMakeResults![Frame108] = 2 Then
Me![Name3].Visible = False
End If
This is in the On Format of the report detail.
Is there a way to put this in a module because I have 12 reports which
have
exactly the same coding.
CurtainMary
 
T

TheNovice

Brenden,

I have a simular problem and cannot seem to get it to work. I have a field
in a report that only need to appear if a field on a Form is checked true. I
followed your logic but when I run it it errors telling me "Error Type
Mismatch"

What am I doing wrong?

Me!Text102.Visible = Forms!frmRecallSubData!chkPrintUsage
--
-The Novice
Learn Today, Teach Tomorrow

Great Success is ones ability to ask for Help.


Brendan Reynolds said:
You could reduce that expression to one line ...

Me![Name3].Visible = (Forms!frmSpecialMakeResults![Frame108] <> 2)

You could put it into a public function in a standard module, but you will
have to add a line of code to each report to call the function, so it will
still take a minimum of one line of code per report, regardless of whether
you use the function or not. If you still want to use a function, it would
look something like this ...

Public Function MakeName3Visible() As Boolean
MakeName3Visible = (Forms!frmSpecialMakeResults![Frame108] <> 2)
End Function

And you would call it like so ...

Me![Name3].Visible = MakeName3Visible()

--
Brendan Reynolds
Access MVP


CurtainMary said:
Jeff Boyce MVP, put me onto a neat way of hiding or displaying fields on a
report, eg
If Forms!frmSpecialMakeResults![Frame108] = 2 Then
Me![Name3].Visible = False
End If
This is in the On Format of the report detail.
Is there a way to put this in a module because I have 12 reports which
have
exactly the same coding.
CurtainMary
 
C

CurtainMary

Hi The Novice, I doubt that Brendan will reply, it is a very old thread.
My thought is that you need to nominate the value of the chk (-1 for yes or
0 for no)
Good day
Curtain Mary

TheNovice said:
Brenden,

I have a simular problem and cannot seem to get it to work. I have a field
in a report that only need to appear if a field on a Form is checked true. I
followed your logic but when I run it it errors telling me "Error Type
Mismatch"

What am I doing wrong?

Me!Text102.Visible = Forms!frmRecallSubData!chkPrintUsage
--
-The Novice
Learn Today, Teach Tomorrow

Great Success is ones ability to ask for Help.


Brendan Reynolds said:
You could reduce that expression to one line ...

Me![Name3].Visible = (Forms!frmSpecialMakeResults![Frame108] <> 2)

You could put it into a public function in a standard module, but you will
have to add a line of code to each report to call the function, so it will
still take a minimum of one line of code per report, regardless of whether
you use the function or not. If you still want to use a function, it would
look something like this ...

Public Function MakeName3Visible() As Boolean
MakeName3Visible = (Forms!frmSpecialMakeResults![Frame108] <> 2)
End Function

And you would call it like so ...

Me![Name3].Visible = MakeName3Visible()

--
Brendan Reynolds
Access MVP


CurtainMary said:
Jeff Boyce MVP, put me onto a neat way of hiding or displaying fields on a
report, eg
If Forms!frmSpecialMakeResults![Frame108] = 2 Then
Me![Name3].Visible = False
End If
This is in the On Format of the report detail.
Is there a way to put this in a module because I have 12 reports which
have
exactly the same coding.
CurtainMary
 
T

TheNovice

CurtainMary,

Actually tried something that I found after what seemed like an eternity.
the following code will hide the group and TADA! not there.

works like a charm.

Enjoy,

Charles Davis

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
If Forms!frmREcallSummDet!chkPrintAdd = False Then
GroupFooter1.Visible = False
GroupFooter1.ForceNewPage = False

End If
End Sub

Private Sub GroupFooter1_Print(Cancel As Integer, PrintCount As Integer)
If Forms!frmREcallSummDet!chkPrintAdd = False Then
GroupFooter1.Visible = False
GroupFooter1.ForceNewPage = False
End If
End Sub




--
-The Novice
Learn Today, Teach Tomorrow

Great Success is ones ability to ask for Help.


CurtainMary said:
Hi The Novice, I doubt that Brendan will reply, it is a very old thread.
My thought is that you need to nominate the value of the chk (-1 for yes or
0 for no)
Good day
Curtain Mary

TheNovice said:
Brenden,

I have a simular problem and cannot seem to get it to work. I have a field
in a report that only need to appear if a field on a Form is checked true. I
followed your logic but when I run it it errors telling me "Error Type
Mismatch"

What am I doing wrong?

Me!Text102.Visible = Forms!frmRecallSubData!chkPrintUsage
--
-The Novice
Learn Today, Teach Tomorrow

Great Success is ones ability to ask for Help.


Brendan Reynolds said:
You could reduce that expression to one line ...

Me![Name3].Visible = (Forms!frmSpecialMakeResults![Frame108] <> 2)

You could put it into a public function in a standard module, but you will
have to add a line of code to each report to call the function, so it will
still take a minimum of one line of code per report, regardless of whether
you use the function or not. If you still want to use a function, it would
look something like this ...

Public Function MakeName3Visible() As Boolean
MakeName3Visible = (Forms!frmSpecialMakeResults![Frame108] <> 2)
End Function

And you would call it like so ...

Me![Name3].Visible = MakeName3Visible()

--
Brendan Reynolds
Access MVP


Jeff Boyce MVP, put me onto a neat way of hiding or displaying fields on a
report, eg
If Forms!frmSpecialMakeResults![Frame108] = 2 Then
Me![Name3].Visible = False
End If
This is in the On Format of the report detail.
Is there a way to put this in a module because I have 12 reports which
have
exactly the same coding.
CurtainMary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top