473,395 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Form display position

Hi

I have a small pop non-dialog form that I need to appear towards the right
side of the screen. Is there a way to achieve this?

Regards
Nov 13 '05 #1
4 9298
In the form's properties under the Format tab, set the autocenter and
autosize properties to No. Click on the Views button on the toolbar and
select form view. Grab the titlebar of the form and drag the form to where
you want it to open on the screen. Close the form. At this point you must
have done something previously to cause Access to ask if you want to save
the changes to the form. If Access does not ask, the position does not get
saved. Assuming you are asked to save, click Yes.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:41**********************@news-text.dial.pipex.com...
Hi

I have a small pop non-dialog form that I need to appear towards the right
side of the screen. Is there a way to achieve this?

Regards

Nov 13 '05 #2
A better way is on the OnOpen event, use the docmd.movesize command (4
options)
you can specify how far from the top, right, hight and width you want the
window to appear.

It does its measurements in twips (1440 twips = 1 inch)

docmd.movesize 1440, 1440 (you dont have to specify the size if you dont
want) this command just said that the top-left corner of the screen is 1
inch in from the left and 1 inch down from the top.
HTH, Paul

"PC Datasheet" <no****@nospam.spam> wrote in message
news:EE*******************@newsread3.news.atl.eart hlink.net...
In the form's properties under the Format tab, set the autocenter and
autosize properties to No. Click on the Views button on the toolbar and
select form view. Grab the titlebar of the form and drag the form to where
you want it to open on the screen. Close the form. At this point you must
have done something previously to cause Access to ask if you want to save
the changes to the form. If Access does not ask, the position does not get
saved. Assuming you are asked to save, click Yes.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:41**********************@news-text.dial.pipex.com...
Hi

I have a small pop non-dialog form that I need to appear towards the
right
side of the screen. Is there a way to achieve this?

Regards


Nov 13 '05 #3
"John" <Jo**@nospam.infovis.co.uk> wrote in
news:41**********************@news-text.dial.pipex.com:
Hi

I have a small pop non-dialog form that I need to appear towards the
right side of the screen. Is there a way to achieve this?

Regards


You might try putting this code in a standard module:

***************
Option Explicit

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

Private Declare Function GetWindowRect Lib "user32" _
(ByVal hwnd As Long, lpRect As Rectangle) As Long

Private Declare Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal X As Long, ByVal y As Long, _
ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Long

Private Const HWND_TOP As Long = 0
Private Const SM_CYVTHUMB As Long = 9
Private Const SWP_NOZORDER As Long = &H4

Private Type Dimensions
Width As Long
Height As Long
End Type

Private Type Rectangle
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Public Sub PlaceFormRight(ByRef Form As Form)

Dim AccessRectangle As Rectangle
Dim AccessWindow As Long

Dim FormDimensions As Dimensions
Dim FormRectangle As Rectangle
Dim FormWindow As Long

Dim NewLeft As Long

AccessWindow = hWndAccessApp
GetWindowRect AccessWindow, AccessRectangle

FormWindow = Form.hwnd
GetWindowRect FormWindow, FormRectangle
With FormRectangle
FormDimensions.Height = .Bottom - .Top
FormDimensions.Width = .Right - .Left
End With

NewLeft = AccessRectangle.Right - FormDimensions.Width -
GetSystemMetrics(SM_CYVTHUMB)

If NewLeft > AccessRectangle.Left Then _
SetWindowPos FormWindow, _
HWND_TOP, _
AccessRectangle.Right - FormDimensions.Width - _
GetSystemMetrics(SM_CYVTHUMB), _
0, _
FormDimensions.Width, _
FormDimensions.Height, _
SWP_NOZORDER

End Sub
*******

and calling ths sub in the form's module as

***********************
Private Sub Form_Activate()
PlaceFormRight Me
End Sub
*******

.... and you might experiment a bit with the system metrics call to get
exactly the result you want.

--
Lyle
--
use iso date format: yyyy-mm-dd
http://www.w3.org/QA/Tips/iso-date
--
The e-mail address isn't, but you could use it to find one.
Nov 13 '05 #4
Actually, it's not a better way unless for some reasom you want a precise
position. Every bit of code increases the load time of an application and
also any code in the form's Open event increases the load time every time
the form is opened.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Paul" <pz****@rogers.com> wrote in message
news:Yv********************@rogers.com...
A better way is on the OnOpen event, use the docmd.movesize command (4
options)
you can specify how far from the top, right, hight and width you want the
window to appear.

It does its measurements in twips (1440 twips = 1 inch)

docmd.movesize 1440, 1440 (you dont have to specify the size if you dont
want) this command just said that the top-left corner of the screen is 1
inch in from the left and 1 inch down from the top.
HTH, Paul

"PC Datasheet" <no****@nospam.spam> wrote in message
news:EE*******************@newsread3.news.atl.eart hlink.net...
In the form's properties under the Format tab, set the autocenter and
autosize properties to No. Click on the Views button on the toolbar and
select form view. Grab the titlebar of the form and drag the form to where you want it to open on the screen. Close the form. At this point you must have done something previously to cause Access to ask if you want to save the changes to the form. If Access does not ask, the position does not get saved. Assuming you are asked to save, click Yes.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:41**********************@news-text.dial.pipex.com...
Hi

I have a small pop non-dialog form that I need to appear towards the
right
side of the screen. Is there a way to achieve this?

Regards



Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: dave | last post by:
Hello, I've got a site project that i've got to design a layout without resorting to tables. I want to use a table for tabular data not any formatting layout, primarily emphasis needs to be on...
1
by: Paul THompson | last post by:
I am using IE to hide sections of a form. When I display the first section (name='ea'), the form widgets are not clickable in IE nor do they accept focus. When I display the 3rd section...
1
by: Alex Wisnoski | last post by:
Access 97SR2-I am trying to create a Job Position data entry form based on a table. The form has 15 fields on it. I want to use a combo box to look in the table and see if the position number...
1
by: kll | last post by:
I have been on newsgroup for week. I have seen anything that will help me. Basically, I have a form with a datagrid that can be sorted or unsorted (it is up to the user). Then, I display the data...
6
by: dale zhang | last post by:
Hi, I build a web form with a 4-cell table on the top (flawlayout), followed by some labels and textboxes (gridlayout). The web form is displayed well in dell m60 laptop with all resolution...
18
by: Colin McGuire | last post by:
Hi - this was posted last weekend and unfortunately not resolved. The solutions that were posted almost worked but after another 5 days of working on the code everynight, I am not further ahead....
4
by: Tomasz Bak | last post by:
Hello, I have a simple problem: mark a list of defects on an image. I think the best way to do it is to select a single deffect, then take two coordinates of coursor form an image on a web...
1
by: grabit | last post by:
Hi Peoples i have a search page with a form field "subject" on my results page i have a paging routine . the first page lists its 10 records no trouble but when i click the "next" link i get a error...
3
by: Andrew Hall | last post by:
Hi all Can anyone advise how to get the position of an open form and how to set the position of an opening form within the access window. I have: MA Access97 (because I do not have the funds...
1
by: =?Utf-8?B?UmljaA==?= | last post by:
I placed a button on a form menustrip for the purpose of causing the horizontal scrollbar of my form to appear so that I can access controls outside of the form's current view (the controls are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.