Positioning text boxes at run time

  • Thread starter Robert Schuldenfrei
  • Start date
R

Robert Schuldenfrei

Dear NG,

I have, what I thought was going to be a trivial issue. A form calls a
report when a button is pushed. The report prints one label at any one of 8
positions on an 8.5 X 11 sheet of label stock paper (Avery 9395). Now if I
define the upper left hand corner of the page using the Page Setup window
everything works fine. For example: if I want the label in column 2 row 2 I
set the Top property to 4.5 and the Left to 3.25. So far so good, but that
requires manually going into the report and setting those two properties. I
would like to PASS those properties from the form to the report at run time.
Can this be done?

If I can not set the page margins under program control, how about locating
the top and left position of each textbox? I have tried Me.Text23.Left =
3.25 but that seems to do nothing.

BTW, I have no problem printing a whole sheet of 8 labels from a query, but
just printing one seems to be beyond me:)

TIA,

Bob
--
Robert Schuldenfrei
S. I. Inc.
3450 So. Ocean Blvd.
Palm Beach, FL 33480
(e-mail address removed)
 
F

fredg

Dear NG,

I have, what I thought was going to be a trivial issue. A form calls a
report when a button is pushed. The report prints one label at any one of 8
positions on an 8.5 X 11 sheet of label stock paper (Avery 9395). Now if I
define the upper left hand corner of the page using the Page Setup window
everything works fine. For example: if I want the label in column 2 row 2 I
set the Top property to 4.5 and the Left to 3.25. So far so good, but that
requires manually going into the report and setting those two properties. I
would like to PASS those properties from the form to the report at run time.
Can this be done?

If I can not set the page margins under program control, how about locating
the top and left position of each textbox? I have tried Me.Text23.Left =
3.25 but that seems to do nothing.

BTW, I have no problem printing a whole sheet of 8 labels from a query, but
just printing one seems to be beyond me:)

TIA,

Bob

What you really seem to want to do is print a label at a certain label
position, not necessarily set the top, left or any other property of
the label. Let Access do the work.

First make sure your label report is properly printing a full sheet of
labels.

Then add a Report Header to your label report.
Add 2 text boxes to the Header.
1) Name one SkipControl
Leave it's control source unbound

2) Name the other SkipCounter
Set it control Source to =[Skip How Many?]

Now code the Report Header Format event as below:

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)
[SkipControl] = "Skip"
Cancel = True
End Sub
==========

Next code the Detail OnPrint event:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If PrintCount <= [SkipCounter] And [SkipControl] = "Skip" Then
Me.NextRecord = False
Me.PrintSection = False
Else
[SkipControl] = "No"
Me.PrintSection = True
Me.NextRecord = True
End If

End Sub
=====

When you are ready to run the label report, it will ask how many to
skip.
Then it will run the report.

You print one label, rather than all in the table, by filtering the
records so that the report's record source returns just the one record
you want to print. There are several ways to do this. If you need help
with this part, post back with more information.
 
R

Robert Schuldenfrei

Dear Fred & NG,

I will give that a try later today. Is it the only way, because I would
really like to set the Page Setup Margins before the report is even
generated? There maybe other times I would like to position type on a page
under program control so I really would like to know how to "set type"
before calling the report. Is this possible? Am I even using the correct
approach? What about my form calling Word or Visio and by passing the
report all together? Thanks, Bob

--
Robert Schuldenfrei
S. I. Inc.
3450 So. Ocean Blvd.
Palm Beach, FL 33480
(e-mail address removed)
fredg said:
Dear NG,

I have, what I thought was going to be a trivial issue. A form calls a
report when a button is pushed. The report prints one label at any one
of 8
positions on an 8.5 X 11 sheet of label stock paper (Avery 9395). Now if
I
define the upper left hand corner of the page using the Page Setup window
everything works fine. For example: if I want the label in column 2 row
2 I
set the Top property to 4.5 and the Left to 3.25. So far so good, but
that
requires manually going into the report and setting those two properties.
I
would like to PASS those properties from the form to the report at run
time.
Can this be done?

If I can not set the page margins under program control, how about
locating
the top and left position of each textbox? I have tried Me.Text23.Left =
3.25 but that seems to do nothing.

BTW, I have no problem printing a whole sheet of 8 labels from a query,
but
just printing one seems to be beyond me:)

TIA,

Bob

What you really seem to want to do is print a label at a certain label
position, not necessarily set the top, left or any other property of
the label. Let Access do the work.

First make sure your label report is properly printing a full sheet of
labels.

Then add a Report Header to your label report.
Add 2 text boxes to the Header.
1) Name one SkipControl
Leave it's control source unbound

2) Name the other SkipCounter
Set it control Source to =[Skip How Many?]

Now code the Report Header Format event as below:

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)
[SkipControl] = "Skip"
Cancel = True
End Sub
==========

Next code the Detail OnPrint event:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If PrintCount <= [SkipCounter] And [SkipControl] = "Skip" Then
Me.NextRecord = False
Me.PrintSection = False
Else
[SkipControl] = "No"
Me.PrintSection = True
Me.NextRecord = True
End If

End Sub
=====

When you are ready to run the label report, it will ask how many to
skip.
Then it will run the report.

You print one label, rather than all in the table, by filtering the
records so that the report's record source returns just the one record
you want to print. There are several ways to do this. If you need help
with this part, post back with more information.
 

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