Re: Using different format depending on screen

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Sophie" <Sophie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BA7173D0-56E1-40D2-BDB1-C35BEA995568@xxxxxxxxxxxxxxxx
greetings

I have an access db that I use at home on a PC with a large screen and on
the road using a laptop. In each of my many forms, the Form_Open event
has a
line like...

DoCmd.MoveSize 150, 6000, 6750, 4770

that works well for the screen in question. I use one set of numbers on
my
PC and another set on the laptop. I'd like the program to somehow
recognize
which computer I'm using so that I can use If...Else If... to set the
correct values for each machine.

I'm really not sure how to do this. Any clues would be appreciated.
--
Thanks
Sophie

How about retrieving the screen dimensions instead of identifying the PC? If
this sounds like a plan to you, then paste the following into a new standard
module:

''' CODE START '''
Private Declare Function GetSystemMetrics Lib "user32" _
(ByVal nIndex As Long) As Long

Public Enum srMetric
srpixels = 1
srtwips = 2
End Enum

Private Const SM_CXSCREEN = 0 'X Size of screen
Private Const SM_CYSCREEN = 1 'Y Size of Screen

Public Function ScreenWidth(Optional Metric As srMetric = srtwips) As Long
t& = GetSystemMetrics(SM_CXSCREEN)
ScreenWidth = IIf(Metric = srpixels, t, t \ 15)
End Function

Public Function ScreenHeight(Optional Metric As srMetric = srtwips) As Long
t& = GetSystemMetrics(SM_CYSCREEN)
ScreenHeight = IIf(Metric = srpixels, t, t \ 15)
End Function
''' CODE END '''

Usage:

lngWidth = ScreenWidth()
lngHeight = ScreenHeight()

will give you the dimensions in twips (which is what you're using in your
MoveSize call).


.