Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Gutter or Mirror margins in Access report

201 views
Skip to first unread message

Kroaky

unread,
Oct 21, 2009, 7:47:39 PM10/21/09
to
Hi, I have been trawling round the net trying to find an answer to
this, but all the solutions I have found so far have given me errors.

I have a three-column report that needs to be printed on both sides of
the paper (duplex) for insertion in a three-ring binder.

Page 1 = Left margin 0.7 inch Right Margin 0.125 inch
Page 2 = Right margin 0.7 inch Left Margin 0.125 inch
and so on...

I have tried every solution on the web, which are variations on this:

http://bytes.com/topic/access/answers/708866-how-do-i-set-gutter-margins

and this:

http://www.tech-archive.net/Archive/Access/microsoft.public.access.modulesdaovba/2007-12/msg00661.html

But I get this error each time:

Run Time Error 2100, the control or subform control is too large for
this location.

If you would like to have a look at the file I am working with it is
here: http://www.kroakys.com/SongbookA.accdb

I am not a VB expert so be gentle ;-)

I appreciate your advice and help. Thank you.

Salad

unread,
Oct 21, 2009, 8:08:01 PM10/21/09
to
Kroaky wrote:

The link is bad. If I remove SongbookA.accdb, it isn't.

Salad

unread,
Oct 21, 2009, 8:14:16 PM10/21/09
to
Kroaky wrote:

What is permissible on your printer? If you had 8 1/2 x 11, could you
print with no margins? Or do you have printer margins? Can it print
with a 1/8" margin on the right on a single page? For example, on my
printer I have .5 margin on both sides. This 8 1/2 becomes 7 1/2
printable space. I could set my margins smaller, but that won't help me.

Kroaky

unread,
Oct 21, 2009, 11:40:18 PM10/21/09
to
On Oct 21, 8:14 pm, Salad <o...@vinegar.com> wrote:
> Kroaky wrote:
> > Hi, I have been trawling round the net trying to find an answer to
> > this, but all the solutions I have found so far have given me errors.
>
> > I have a three-column report that needs to be printed on both sides of
> > the paper (duplex) for insertion in a three-ring binder.
>
> > Page 1 = Left margin 0.7 inch Right Margin 0.125 inch
> > Page 2 = Right margin 0.7 inch Left Margin 0.125 inch
> > and so on...
>
> > I have tried every solution on the web, which are variations on this:
>
> >http://bytes.com/topic/access/answers/708866-how-do-i-set-gutter-margins
>
> > and this:
>
> >http://www.tech-archive.net/Archive/Access/microsoft.public.access.mo...

>
> > But I get this error each time:
>
> > Run Time Error 2100, the control or subform control is too large for
> > this location.
>
> > If you would like to have a look at the file I am working with it is
> > here:http://www.kroakys.com/SongbookA.accdb
>
> > I am not a VB expert so be gentle ;-)
>
> > I appreciate your advice and help. Thank you.
>
> What is permissible on your printer?  If you had 8 1/2 x 11, could you
> print with no margins?  Or do you have printer margins?  Can it print
> with a 1/8" margin on the right on a single page?  For example, on my
> printer I have .5 margin on both sides.  This 8 1/2 becomes 7 1/2
> printable space.  I could set my margins smaller, but that won't help me.

Hi, thanks for replying. The pages with the current margins print
fine. The printer margins are 0.125 inch all round. I just need to
shift the margins on the odd/even pages.

The link was bad because of the file type. Try this: http://www.kroakys.com/SongbookA.zip


Salad

unread,
Oct 22, 2009, 12:41:33 AM10/22/09
to
OK. Looking at the code, it was written by Allen Browne. I'll trust
his code, yours not so much.

Are you using twips or inches for your shifting. You could draw a few
lines on a dummy report with 1 record (ex Line 1...Line4) of various
sizes; 1/4 inch 1/2 inch, 3/4 inch and 1 inch. Then in the page header
code enter something line
DIm I as integer
For i = 1 to 4
msgbox Me("Line" & i).Width
Debug.print Me("Line" & i).Width
Next
You'll now see the width of each line in twips. You should be able to
figure out the difference in twips between page 1 and page 2...how many
twips to shift. Does this help? You should be able to see if your
current shift is making it makes a control go beyond the size of the report.


Kroaky

unread,
Oct 22, 2009, 2:38:36 AM10/22/09
to

I created a single column layout. I drew some horizontal lines. Then I
added the code snippet to the Header section but the result will not
display

Do I have to add a messagebox to the Design layout?

I also tried this Allen Browne code on the single column layout.

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Dim ctl As Control
Dim iGutter As Integer

'Use half an inch gutter on the even pages.
If (Me.Page Mod 2) = 0 Then
iGutter = 720
End If

For Each ctl In Me.Controls
If IsNumeric(ctl.Tag) Then
ctl.Left = CInt(ctl.Tag) + iGutter
End If
Next
End Sub

But it doesn't move anything. Even if I change the value of iGutter to
-1550 there's no movement.

I wonder if i am making a newbie error.

Thank you for your patience

Salad

unread,
Oct 22, 2009, 3:10:53 AM10/22/09
to

Did you add a number, like 1, in the tag property field? If the tag
value is 1, or 1 twip (there's 1440 twips per inch, so 720 is a 1/2
inch), how'd you even know if there were a change?

Allen Browne

unread,
Oct 22, 2009, 7:51:42 AM10/22/09
to
Nothing happens at all?

If you are using Access 2007, perhaps you are in Layout view or Report view.
The events don't fire in these views. Try Print or Print Preview.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Kroaky" <criss...@gmail.com> wrote in message
news:1262d521-2a4a-427d-8451->

Kroaky

unread,
Oct 22, 2009, 8:49:27 AM10/22/09
to
On Oct 22, 7:51 am, "Allen Browne" <AllenBro...@SeeSig.invalid> wrote:
> Nothing happens at all?
>
> If you are using Access 2007, perhaps you are in Layout view or Report view.
> The events don't fire in these views. Try Print or Print Preview.
>
> --
> Allen Browne - Microsoft MVP.  Perth, Western Australia
> Tips for Access users -http://allenbrowne.com/tips.html

> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Kroaky" <crisscr...@gmail.com> wrote in message

>
> news:1262d521-2a4a-427d-8451->
>
>
>
> > I also tried this Allen Browne code on the single column layout.
>
> > Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
> > Integer)
> > Dim ctl As Control
> > Dim iGutter As Integer
>
> > 'Use half an inch gutter on the even pages.
> > If (Me.Page Mod 2) = 0 Then
> > iGutter = 720
> > End If
>
> > For Each ctl In Me.Controls
> > If IsNumeric(ctl.Tag) Then
> > ctl.Left = CInt(ctl.Tag) + iGutter
> > End If
> > Next
> > End Sub
>
> > But it doesn't move anything. Even if I change the value of iGutter to
> > -1550 there's no movement.
>
> > I wonder if i am making a newbie error.
>
> > Thank you for your patience

Nothing happens at all. Perhaps I am missing something basic.

I added 1 to the tag property field. No change. 1000, still no change

I am definitely in Print Preview.

Allen Browne

unread,
Oct 22, 2009, 10:52:57 AM10/22/09
to
To verify the code is actually executing, add a line like this to the top of
your procedure:
Debug.Print PageHeaderSection_Format() & " for " & Me.Name & " at " &
Now()

Then add further debug.print statements to see if the controls moved, e.g.:
If IsNumeric(ctl.Tag) Then
Debug.Print ctl.Name & ".Left was " & .Left,


ctl.Left = CInt(ctl.Tag) + iGutter

Debug.Print ctl.Name & ", now is " & .Left
End If

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Tips for Access users - http://allenbrowne.com/tips.html


Reply to group, rather than allenbrowne at mvps dot org.

"Kroaky" <criss...@gmail.com> wrote in message

news:ba4e38c6-ae63-4bd3...@33g2000vbe.googlegroups.com...

Kroaky

unread,
Oct 22, 2009, 1:02:50 PM10/22/09
to
On Oct 22, 10:52 am, "Allen Browne" <AllenBro...@SeeSig.invalid>
wrote:

> To verify the code is actually executing, add a line like this to the top of
> your procedure:
>     Debug.Print PageHeaderSection_Format() & " for " & Me.Name & " at " &
> Now()
>
> Then add further debug.print statements to see if the controls moved, e.g.:
>     If IsNumeric(ctl.Tag) Then
>         Debug.Print ctl.Name & ".Left was " & .Left,
>         ctl.Left = CInt(ctl.Tag) + iGutter
>         Debug.Print ctl.Name & ", now is " & .Left
>     End If
>
> --
> Allen Browne - Microsoft MVP.  Perth, Western Australia

Hi, I still don't get anything. No output from the code at all. Just
to make sure it's right from the beginning, I right click on The Page
Header and choose Build Code, then I input:

==

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Dim ctl As Control
Dim iGutter As Integer

Debug.Print PageHeaderSection_Format() & " for " & Me.Name & " at " &
Now()

'Use half an inch gutter on the even pages.


If (Me.Page Mod 2) = 0 Then
iGutter = 720
End If

If IsNumeric(ctl.Tag) Then


Debug.Print ctl.Name & ".Left was " & .Left

ctl.Left = CInt(ctl.Tag) + iGutter
Debug.Print ctl.Name & ", now is " & .Left
End If

Next
End Sub

====

And then I close that window and return to the design view. The design
view has a single field and its label. I select Print Preview. I see
the field output but no code output.

Am I missing some kind of "turn the code on" switch?

Marshall Barton

unread,
Oct 22, 2009, 2:13:59 PM10/22/09
to
Kroaky wrote:
>Hi, I still don't get anything. No output from the code at all. Just
>to make sure it's right from the beginning, I right click on The Page
>Header and choose Build Code, then I input:
>
>Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
>Integer)
>Dim ctl As Control
>Dim iGutter As Integer
>Debug.Print PageHeaderSection_Format() & " for " & Me.Name & " at " &
>Now()
>
>'Use half an inch gutter on the even pages.
>If (Me.Page Mod 2) = 0 Then
>iGutter = 720
>End If
>
>If IsNumeric(ctl.Tag) Then
> Debug.Print ctl.Name & ".Left was " & .Left
> ctl.Left = CInt(ctl.Tag) + iGutter
> Debug.Print ctl.Name & ", now is " & .Left
>End If
>Next
>End Sub
>
>And then I close that window and return to the design view. The design
>view has a single field and its label. I select Print Preview. I see
>the field output but no code output.
>
>Am I missing some kind of "turn the code on" switch?


Maybe you are. Double check to maje sure the page header
section's OnFormat property contains:
[Event Procedure]

--
Marsh

Kroaky

unread,
Oct 22, 2009, 3:18:44 PM10/22/09
to

Yes it contains [Event Procedure]. DDoes the code need to be complied
or otherwise processed to work?

Marshall Barton

unread,
Oct 22, 2009, 5:05:31 PM10/22/09
to
Kroaky wrote:

>Yes it contains [Event Procedure]. Does the code need to be complied


>or otherwise processed to work?


You should use Debug - Compile before testing any change,
but the code will be compiled one way or another before
before it runs.

The only other thing I can think that might cause the code
to not be called is if your page header section is named
something other than PageHeaderSection.

What happens when you click the [...] builder button on the
OnFormat line in the page header section's property sheet?
It should put the cursor in your code procedure.

--
Marsh

Allen Browne

unread,
Oct 22, 2009, 9:01:37 PM10/22/09
to
Or, you may find that no code is running in your Access 2007 database unless
it's in a trusted location.

To trust your folder, click:

* Office Button (top left)
* Access Options (bottom of dialog)
* Trust Center (left)
* Trust Center Settings (button)
* Trusted Locations (left)
* Add new location (button)


--
Allen Browne - Microsoft MVP. Perth, Western Australia

Tips for Access users - http://allenbrowne.com/tips.html


Reply to group, rather than allenbrowne at mvps dot org.


"Marshall Barton" <marsh...@wowway.com> wrote in message
news:jrh1e55u9uqcgm64u...@4ax.com...

0 new messages