A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Printing Selective Fields,Labels and Boxes in a Report.



 
 
Thread Tools Display Modes
  #1  
Old April 10th, 2007, 09:22 AM posted to microsoft.public.access.reports
Steve
external usenet poster
 
Posts: 2,662
Default Printing Selective Fields,Labels and Boxes in a Report.

How do I hide from view (and print), a selection of 6 labels and 5 boxes
from a report based on a condition of the data for each record.
Eg. IIf(Mid[myfield],5,1)="G")
I'm afraid I will need the exact syntax for this please.
Also, based on an earlier reply to Cindy on this subject - I could not get
the following to work in my report.
Report Section - On Open - =[myfield].Visible=No
[myfield] still displays!!
Hope you can help... Thanks

Steve
  #2  
Old April 10th, 2007, 10:36 AM posted to microsoft.public.access.reports
Ofer Cohen
external usenet poster
 
Posts: 1,683
Default Printing Selective Fields,Labels and Boxes in a Report.

You can use the OnPrint event of the detail section where this text boxes
located in, write the code

Me.[TextBoxName].Visible = Not (Mid([myfield],5,1) = "G" )

The same for the rest of the text boxes, just change the name

--
Good Luck
BS"D


"Steve" wrote:

How do I hide from view (and print), a selection of 6 labels and 5 boxes
from a report based on a condition of the data for each record.
Eg. IIf(Mid[myfield],5,1)="G")
I'm afraid I will need the exact syntax for this please.
Also, based on an earlier reply to Cindy on this subject - I could not get
the following to work in my report.
Report Section - On Open - =[myfield].Visible=No
[myfield] still displays!!
Hope you can help... Thanks

Steve

  #3  
Old April 10th, 2007, 06:02 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Printing Selective Fields,Labels and Boxes in a Report.

Steve wrote:

How do I hide from view (and print), a selection of 6 labels and 5 boxes
from a report based on a condition of the data for each record.
Eg. IIf(Mid[myfield],5,1)="G")
I'm afraid I will need the exact syntax for this please.
Also, based on an earlier reply to Cindy on this subject - I could not get
the following to work in my report.
Report Section - On Open - =[myfield].Visible=No
[myfield] still displays!!



That's an expression. Where did you put it so it did not
cause an error, in some property??

You need a line of VBA code in the report's Open event
**procedure**:

Me.[myfield].Visible=False

The report's OnOpen property should have [Event Procedure]

--
Marsh
MVP [MS Access]
  #4  
Old April 11th, 2007, 07:44 AM posted to microsoft.public.access.reports
Steve
external usenet poster
 
Posts: 2,662
Default Printing Selective Fields,Labels and Boxes in a Report.

Thanks Ofer Cohen,
But this gives me an error - Can't find Macro "Me." I'm sure I have typed it
as you have suggested.
Also, are you suggesting I put muliple entries in the same line of the
OnPrint event of the detail section for the rest of the text boxes. Are they
separated by any character(s)?
--
Steve


"Ofer Cohen" wrote:

You can use the OnPrint event of the detail section where this text boxes
located in, write the code

Me.[TextBoxName].Visible = Not (Mid([myfield],5,1) = "G" )

The same for the rest of the text boxes, just change the name

--
Good Luck
BS"D


"Steve" wrote:

How do I hide from view (and print), a selection of 6 labels and 5 boxes
from a report based on a condition of the data for each record.
Eg. IIf(Mid[myfield],5,1)="G")
I'm afraid I will need the exact syntax for this please.
Also, based on an earlier reply to Cindy on this subject - I could not get
the following to work in my report.
Report Section - On Open - =[myfield].Visible=No
[myfield] still displays!!
Hope you can help... Thanks

Steve

  #5  
Old April 11th, 2007, 07:56 AM posted to microsoft.public.access.reports
Steve
external usenet poster
 
Posts: 2,662
Default Printing Selective Fields,Labels and Boxes in a Report.

Thanks Marshall,
Now I need the conditional IIf statement, but I can't get the syntax right.
What I have below works, but I need the condition to be replaced/changed and
based on the following - "IIf (Mid([DevelopmentNumber], 5, 1) = "G")"

"Private Sub Report_Open(Cancel As Integer)
If Me.DevelopmentNumber.Visible = True Then
Me.Label31.Visible = False
Me.Label32.Visible = False
Me.Box36.Visible = False
End If
End Sub"

Can you give me the right syntax please.
--
Steve


"Marshall Barton" wrote:

Steve wrote:

How do I hide from view (and print), a selection of 6 labels and 5 boxes
from a report based on a condition of the data for each record.
Eg. IIf(Mid[myfield],5,1)="G")
I'm afraid I will need the exact syntax for this please.
Also, based on an earlier reply to Cindy on this subject - I could not get
the following to work in my report.
Report Section - On Open - =[myfield].Visible=No
[myfield] still displays!!



That's an expression. Where did you put it so it did not
cause an error, in some property??

You need a line of VBA code in the report's Open event
**procedure**:

Me.[myfield].Visible=False

The report's OnOpen property should have [Event Procedure]

--
Marsh
MVP [MS Access]

  #6  
Old April 11th, 2007, 09:22 AM posted to microsoft.public.access.reports
Ofer Cohen
external usenet poster
 
Posts: 29
Default Printing Selective Fields,Labels and Boxes in a Report.

Hi Steve,
Usually you get this error message when you enter this line directly in the
property box, in that case Access looks for a macro.
When the cursor located in the OmPrint property, there is a button with
three dots, click it and select code view.

In the code section enter the code

sub ....()

' For each text box
Me.[TextBox1Name].Visible = Not (Mid([myfield],5,1) = "G" )
Me.[TextBox2Name].Visible = Not (Mid([myfield],5,1) = "G" )
Me.[TextBox3Name].Visible = Not (Mid([myfield],5,1) = "G" )

End Sub

The OnOpen event will work only once, when the report is loaded.
The OnPrint event in the detail section will works for every record printed,
so it will make the fields visible or not depend on the value of myfield in
every record


Good Luck
BS"D

"Steve" wrote in message
...
Thanks Ofer Cohen,
But this gives me an error - Can't find Macro "Me." I'm sure I have typed

it
as you have suggested.
Also, are you suggesting I put muliple entries in the same line of the
OnPrint event of the detail section for the rest of the text boxes. Are

they
separated by any character(s)?
--
Steve


"Ofer Cohen" wrote:

You can use the OnPrint event of the detail section where this text

boxes
located in, write the code

Me.[TextBoxName].Visible = Not (Mid([myfield],5,1) = "G" )

The same for the rest of the text boxes, just change the name

--
Good Luck
BS"D


"Steve" wrote:

How do I hide from view (and print), a selection of 6 labels and 5

boxes
from a report based on a condition of the data for each record.
Eg. IIf(Mid[myfield],5,1)="G")
I'm afraid I will need the exact syntax for this please.
Also, based on an earlier reply to Cindy on this subject - I could not

get
the following to work in my report.
Report Section - On Open - =[myfield].Visible=No
[myfield] still displays!!
Hope you can help... Thanks

Steve



  #7  
Old April 11th, 2007, 06:42 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Printing Selective Fields,Labels and Boxes in a Report.

Steve wrote:
Now I need the conditional IIf statement, but I can't get the syntax right.
What I have below works, but I need the condition to be replaced/changed and
based on the following - "IIf (Mid([DevelopmentNumber], 5, 1) = "G")"

"Private Sub Report_Open(Cancel As Integer)
If Me.DevelopmentNumber.Visible = True Then
Me.Label31.Visible = False
Me.Label32.Visible = False
Me.Box36.Visible = False
End If
End Sub"



that code does not relate to your question. What effect are
you trying to get?

The best I can say at this point is that Ofer already
explained how to do what I'm guessing you want.

--
Marsh
MVP [MS Access]
  #8  
Old April 12th, 2007, 09:26 AM posted to microsoft.public.access.reports
Steve
external usenet poster
 
Posts: 2,662
Default Printing Selective Fields,Labels and Boxes in a Report.

Thanks Heaps Offer - this worked a treat. Very much appreciated your
assistance.
How good is this facility!
--
Aussie Steve


"Ofer Cohen" wrote:

Hi Steve,
Usually you get this error message when you enter this line directly in the
property box, in that case Access looks for a macro.
When the cursor located in the OmPrint property, there is a button with
three dots, click it and select code view.

In the code section enter the code

sub ....()

' For each text box
Me.[TextBox1Name].Visible = Not (Mid([myfield],5,1) = "G" )
Me.[TextBox2Name].Visible = Not (Mid([myfield],5,1) = "G" )
Me.[TextBox3Name].Visible = Not (Mid([myfield],5,1) = "G" )

End Sub

The OnOpen event will work only once, when the report is loaded.
The OnPrint event in the detail section will works for every record printed,
so it will make the fields visible or not depend on the value of myfield in
every record


Good Luck
BS"D

"Steve" wrote in message
...
Thanks Ofer Cohen,
But this gives me an error - Can't find Macro "Me." I'm sure I have typed

it
as you have suggested.
Also, are you suggesting I put muliple entries in the same line of the
OnPrint event of the detail section for the rest of the text boxes. Are

they
separated by any character(s)?
--
Steve


"Ofer Cohen" wrote:

You can use the OnPrint event of the detail section where this text

boxes
located in, write the code

Me.[TextBoxName].Visible = Not (Mid([myfield],5,1) = "G" )

The same for the rest of the text boxes, just change the name

--
Good Luck
BS"D


"Steve" wrote:

How do I hide from view (and print), a selection of 6 labels and 5

boxes
from a report based on a condition of the data for each record.
Eg. IIf(Mid[myfield],5,1)="G")
I'm afraid I will need the exact syntax for this please.
Also, based on an earlier reply to Cindy on this subject - I could not

get
the following to work in my report.
Report Section - On Open - =[myfield].Visible=No
[myfield] still displays!!
Hope you can help... Thanks

Steve




  #9  
Old April 13th, 2007, 09:02 AM posted to microsoft.public.access.reports
Steve
external usenet poster
 
Posts: 2,662
Default Printing Selective Fields,Labels and Boxes in a Report.

Thanks Marshall - it appears that I can achieve what I want 2 different ways
and yes I've followed Offer's suggestion which is working for me. I was
interested in trying your way also with the approriate If statement based on
the Mid() function, as previously explained.
No matter now.
--
Steve


"Marshall Barton" wrote:

Steve wrote:
Now I need the conditional IIf statement, but I can't get the syntax right.
What I have below works, but I need the condition to be replaced/changed and
based on the following - "IIf (Mid([DevelopmentNumber], 5, 1) = "G")"

"Private Sub Report_Open(Cancel As Integer)
If Me.DevelopmentNumber.Visible = True Then
Me.Label31.Visible = False
Me.Label32.Visible = False
Me.Box36.Visible = False
End If
End Sub"



that code does not relate to your question. What effect are
you trying to get?

The best I can say at this point is that Ofer already
explained how to do what I'm guessing you want.

--
Marsh
MVP [MS Access]

  #10  
Old April 13th, 2007, 06:59 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Printing Selective Fields,Labels and Boxes in a Report.

Steve wrote:

Thanks Marshall - it appears that I can achieve what I want 2 different ways
and yes I've followed Offer's suggestion which is working for me. I was
interested in trying your way also with the approriate If statement based on
the Mid() function, as previously explained.
No matter now.



Once I figured out what you were trying to do, I would have
suggested the same thing Ofer said. There are other code
sequences that will accomplish the same thing, but they
would have more lines of code to no benefit in your case.

--
Marsh
MVP [MS Access]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:53 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.