We help IT Professionals succeed at work.

Thickness of lines using DrawWidth in reports

tbsgadi asked
Medium Priority
Last Modified: 2009-07-29
Hi Experts,
I'm using the Line Function to draw some thicklines in my report
I've got lot's of code similar to this scattered around different reports.

Private Sub GroupHeader0_Print(Cancel As Integer, PrintCount As Integer)
Me.DrawWidth = gBorderWidth
Me.Line (0, 0)-(0, 1000)
Me.Line (ScaleWidth, 0)-(ScaleWidth, 1000)

End Sub

The code works ..however in one report I set gBorderWidth=7 & in another I have to set it to 13 to get the same line thickness.

I've now changed both reports so that they have the same width, same margins etc etc.
I don't use Scalemode
The only difference in the reports is the length.
Why don't the thickness of the lines come out the same?
Watch Question


I believe the line thickness defaults to that of the font used in the report, unless the draw width is specified as shown below:

           Me.DrawWidth = 13              ' larger number, thicker line
           Me.DrawStyle = 0                ' 0 to 6 = solid to invisible


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


That's my point..All the fonts are the same & I don't touch DrawStyle
My mistake...it defaults to the thickness of the line in the line tool from the toolbox, unless the draw width is specified.  See this link:



I do specify the draw width & I don't have any lines in the report.
In one report I specify 80 to get the same line as another where I write 7 !
In your code (above), you specified a relative size for your draw width (= gBorderWidth)....you did not specify any absolutes as I do in my code (Me.DrawWidth = 13).  In addition, you have changed other properties as well. I suggest that you go to the toolbox and set the (absolute) defaults for the drawing objects you use, as implied in the link I gave you.  Once you set the default properties for objects in your toolbox, you won't need to refer to these properties in code, unless you are overriding the default.


First of all I want a line thicker than 6 points & secondly I'm drawing lines in code.
gBorderWidth is just a property I set it to 7 ,13 ,or 80 depending on the report.
I get the same results if I put in an absolute.
I am not going to split hairs with you on this.  As I told you, the final presentation in your report is based on a combination of factors, including the font, the border width, line thickness, scale height and width....all of which have default properties. Until you eliminate your use of relative defaults and set absolute defaults ( either in code or in the property sheet) for each and every object that is impacting your final presentation, you will continue to have to adjust from report to report....unless, maybe if you create a template report via the auto format tool, that you will use for any new reports that you create.


I changed eveything to absolute defaults but it didn't help...:<
The only thing I can do is to build all the reports from scratch... which was what I was trying to avoid.
Wow! The only thing I can think of is that there are some constraints that are not being followed.  For example:  If you set the BorderWidth property of the Line control greater than one, the BorderStyle property has no effect.

The only halfway decent reference I can find on the subject is at this link under the section entitled "Creating Graphics"  (about halfway down the web page):

           Que Platinum Edition Using Visual Basic 5 -- Bonus Chapter 1 -- Doing Graphics

        Maybe this reference will help you ...it contains sample code.  If this doesn't help, let me know.  

Also. re doing your reports from scratch....I don't think you need to do that .......Before creating reports from scratch, I would use the customized autoFormat option to create templates as follows:
To use any existing form or report or a specially created form or report to use as a template:

From the Tools menu (View in Access 2), choose Options
select Form & report design
type the name of the form or report in Form Template or Report Template
Using Autoformat
In Access 2000 you can standardise Forms and Reports with autoformat (having a form/ report called Normal does not seem to work anymore). AutoFormat automatically applies a standard formatting styles to a form. To use AutoFormat, add a customized format to the Form AutoFormats list by the following method:
Create a form that uses your standard fonts, colours, borders, background bitmaps, and control properties.
With the form open in Design view, go to Format/ AutoFormat, and click Customize.
Under Customize options in the Customize AutoFormat dialog box, select Create A New AutoFormat Based On The Form and click OK.
Enter a name for the standard style in the New Style Name dialog box, and click OK.
Click Close.
When you want to apply the standard formats to a form, open the form in Design view, select Format/ AutoFormat, select your style from the Form AutoFormats list, and click OK.
If you need to update your standard style, create a form that includes the changes, select Format/ AutoFormat, and select the style you want to update from the Form AutoFormats list. Click Customize, and select the update option under Customize Options. Click OK twice.  

Hope this helps.

Maybe this will help.  Excel's macro recorder will record drawing objects and shapes.....crate your objects in excel, then you could look at the code generated in the macro.....and compare it to the code you have.


How did you finally resolve this?


I didn't!
Oh....then you should have requested a refund.


You deserve something for your hard work!
Thanks Gary.  I will keep my eyes open for a solution and let you know if something turns up.
this link may have what you need to resolve your questions:

Excerpt from the link:  http://safari5.bvdep.com/0789730049/ch09lev1sec4#ch09lev1sec4
           Did You Know?
You can set control defaults. When you create a control, you can set the initial formatting. Create a control, format the control the way you want, click the Format menu, and then click Set Control Defaults
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.