Re: Using different format depending on screen
- From: "Stuart McCall" <smccall@xxxxxxxxxxxxxxx>
- Date: Sun, 6 Jan 2008 00:55:56 -0000
"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).
.
- Follow-Ups:
- Re: Using different format depending on screen
- From: Sophie
- Re: Using different format depending on screen
- Prev by Date: Re: How to insert a '*' in certain controls when Enter is pressed.
- Next by Date: Re: Populate 2nd Form w/Data from First
- Previous by thread: Re: Structural question - URGENT, as I guess they all are :)
- Next by thread: Re: Using different format depending on screen
- Index(es):