Me.WindowWidth (1 Viewer)

InFlight

User
Local time
Tomorrow, 01:37
Joined
Jun 11, 2015
Messages
130
Hi

I am trying to resize a form, but Me.WindowWidth but gives me a negative number on a 28 inch screen but it is ok on my 17 inch laptop

i am using Abs(Me.WindowWidth) as a fix but only use's 3/4 of the screen
Using access 2010

Does any one know why.

:confused:
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:37
Joined
Oct 29, 2018
Messages
21,357
Hi. Are you, by any chance, hiding the Access window/shell?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 07:37
Joined
Feb 28, 2001
Messages
26,996
Please check this link: https://support.office.com/en-us/article/access-specifications-0cf3c66f-9cf2-4e32-9568-98c1025bb47c

You will find that the maximum width for a form is 22.75 inches. You are going to 28 inches.

I think the techie reason is that screen widths get computed in twips (1440/inch) and if you do the math, 28 inches is over 40,000 twips. To get a negative number means that the form's width is probably stored as a 16-bit quantity and your 28 inch width overflowed (i.e. the sign bit got overwritten by a numeric bit). If you do the math, you see that 22.75 inches x 1440 twips/inch = 32760 twips, just under 32767, the highest legal integer in a 16-bit signed integer.

You said that you only use about 3/4 of the width. Well, 3/4 of 28 inches is 21 inches, just under the 22.75 limit. Pretty close.
 

isladogs

MVP / VIP
Local time
Today, 12:37
Joined
Jan 14, 2017
Messages
18,186
For info, I had exactly the same issue with the total number of pages on a monster report. Where the [Pages] expression exceeds the long integer limit of 32767 it goes negative. See http://www.mendipdatasystems.co.uk/negative-total-report-pages/4594515908
In that case I was able to adapt the calculation (with assistance from jdraw) so it always read correctly.
However the maximum limit of 22.75 inches (approx. 32767 twips) for form and report widths is cast in stone. Similarly the maximum height of each section
Nor can you use AFR to go beyond the 22.75 inches limits.
 

Users who are viewing this thread

Top Bottom