Textbox positioning problem

G

Guest

Hello,

I'm trying to make a report that will be used for printing a hardcopy of a
data input form [survey type].
One of the problems I've run into is with the positioning of unbound text
boxes next to subreport controls.
On the form, I have continuous subforms and next to some of them are unbound
textboxes that are made visible when a certain checkbox in the subreport is
checked. The texboxes are lined up with the checkboxes/questions so that it
is clear they belong to them.
On the report, however, I am having great difficulties positioning these
textboxes. I can either put them right underneath the subreport control so
they'll show up below the subreport, but when I move them a bit higher, they
end up somewhere in the middle [and of course to the right] of the subreport.

Does somebody have a suggestions to overcome this problem?

Thank you.
 
G

Guest

I'm still curious why this is happening, but I have realized that I have no
choice but to put the text boxes underneath the subreport controls since the
printed subreports tend to be a lot larger than their controls, and it would
be too much of a waste of design space to try to position the text boxes any
other way.
 
M

Marshall Barton

Niniel said:
I'm still curious why this is happening, but I have realized that I have no
choice but to put the text boxes underneath the subreport controls since the
printed subreports tend to be a lot larger than their controls, and it would
be too much of a waste of design space to try to position the text boxes any
other way.


There's a catch22 if you try to reposition the text box so
it lines up with the bottom line in the memo text box. You
can not determine the height of the memo text box until the
section's Print event, but you can only modify the unbound
text box's position in the section's Format event.

The way to get the text in the unbound text box to be
displayed where you want it is to use the report's Print
method in the section's Print event. Try something like:

Me.CurrentX = Me.unbound.Left
Me.CurrentY = Me.memo.Top _
+ Me.memo.Height - Me.unbound.Height
Me.FontName = Me.unbound.FontName
Me.FontSize = Me.unbound.FontSize
Me.ForeColor = Me.unbound.ForeColor
Me.Print Me.unbound
 
G

Guest

Hello Marsh,

Thank you for your suggestion.
That is a neat idea, I shall certainly give it a try. One question though -
are font name, size and colour required, or can those be left out? Also,
where can I expect the lining up to happen - in print preview, or only in the
actual printout?
 
M

Marshall Barton

You do not have to specify the font properties, but then you
will get some default settings that are unlikely to match
the rest of the report. The code I posted allows you to
specify what you want in the text box's property sheet
instead of hard coding the properties in the code. Play
around with it as see what happens.

Preview and Print should be as identical as the two
different devices can make it.
 
G

Guest

Ok, I tried it out, but it isn't working, RNote3 doesn't see to be affected
at all, it's still where I placed it.

Private Sub Detail_Print(cancel As Integer, PrintCount As Integer)

Me.CurrentX = Me.RNote3.Left
Me.CurrentY = Me.srptEducationalFormat1.Top +
Me.srptEducationalFormat1.Height - Me.RNote3.Height
Me.FontName = Me.RNote3.FontName
Me.FontSize = Me.RNote3.FontSize
Me.ForeColor = Me.RNote3.ForeColor
Me.Print Me.RNote3

End Sub
 
M

Marshall Barton

Niniel said:
Ok, I tried it out, but it isn't working, RNote3 doesn't see to be affected
at all, it's still where I placed it.

Private Sub Detail_Print(cancel As Integer, PrintCount As Integer)

Me.CurrentX = Me.RNote3.Left
Me.CurrentY = Me.srptEducationalFormat1.Top +
Me.srptEducationalFormat1.Height - Me.RNote3.Height
Me.FontName = Me.RNote3.FontName
Me.FontSize = Me.RNote3.FontSize
Me.ForeColor = Me.RNote3.ForeColor
Me.Print Me.RNote3

End Sub


I guess I needed to explain that the text box should be
invisible so it doesn't get in the way.

Regardless of that, the value of the text box should have
been displayed next to the bottom of the memo.
 

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