Simulate Access textbox margins

 

Access doesn't have a text indent or margin property for its textbox controls. However, you can create the appearance of a textbox margin on your reports by drawing a box around the control

instead of displaying field borders. To do so, first set the control's BorderStyle property to Transparent. Next, you'll set up Access to draw a box when the report is printed. The sample

code below draws a box with a 60 Twip margin around a control called TestMem:

 

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

Dim intMargin As Integer

intMargin = 60

With Me.TestMem

Me.Line ((.Left - intMargin), (.Top - intMargin))-Step((.Width + _

(intMargin * 2)), (.Height + (intMargin * 2))), 0, B

End With

End Sub

 

Access is able to accommodate controls that have their CanGrow property set to True because we're generating the box in the Detail Print event. At this point, Access will have already

calculated the final height of the control.

Access Index

Main Index

Search RD Techbase