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:
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.
The link is bad. If I remove SongbookA.accdb, it isn't.
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
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.
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
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?
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->
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.
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...
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
Yes it contains [Event Procedure]. DDoes the code need to be complied
or otherwise processed to work?
>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
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...