Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

open form on second monitor

1,444 views
Skip to first unread message

bobh

unread,
Jun 10, 2009, 3:58:00 PM6/10/09
to
Hi All,

Here at my company everyone has dual monitors and in AccessXP I'm
trying to get one form to open on one screen as a pop-up(basically a
new record entry screen). It has a button on it 'Open Reference
Screen' and when the user clicks that button I want another form
(query-by-form form) to open on the second screen maximized.

I have on idea of how to do that, has anyone done that? if so, care to
share your vba code?
thanks
bobh.

Marshall Barton

unread,
Jun 10, 2009, 6:08:46 PM6/10/09
to
bobh wrote:
>Here at my company everyone has dual monitors and in AccessXP I'm
>trying to get one form to open on one screen as a pop-up(basically a
>new record entry screen). It has a button on it 'Open Reference
>Screen' and when the user clicks that button I want another form
>(query-by-form form) to open on the second screen maximized.


You can use DoCmd.MoveSize to put it on the other monitor.
If the second monitor is to the left or above the primary
monitor, use a corresponding negative position.

After the form has been moved to the other monitor, you can
use DoCmd.Maximize

--
Marsh

bobh

unread,
Jun 11, 2009, 10:28:57 AM6/11/09
to

Thanks for your response,
but I don't think it's a guarantee for each user that it's the same
primary/secondary monitor setup nor of it's position. Although, I have
not seen any setups that are one on top of each other but some users
use the rightside monitor as the primary while others use the leftside
monitor as the primary. Solving this is not going to be fun, at all.

I tried opening the pop up screen first(this is the new record entry
screen) and I then moved it over to the secondary monitor and clicked
on the 'Open Reference Screen' button. That form(a continuous form)
opened maximized on the primary monitor so all was good. But, after
making the entry and closing the pop-up form and the reference form
and closing Access the next time I opened the application and opened
the pop-up it defaulted back to the primary monitor, it did not
remember to 'pop-up' in the same position as it did the last time it
was opened for that user, which is what I was hoping for and I made
sure that I had the pop-up's properties of Auto Center and Auto Resize
set to no.
bobh.

bobh

unread,
Jun 11, 2009, 11:01:15 AM6/11/09
to
> bobh.- Hide quoted text -
>
> - Show quoted text -

I'm wondering if anybody has a vba function(as I would not have a clue
as to what that would look like) that will capture the position of a
form after it's moved and store that information in a table? Then I
could, on the form open event, read and open the form using those co-
ordinates that were stored for that user. If that's possible then I
could open the pop-up form at the last placement that it was closed
at.
bobh.

Marshall Barton

unread,
Jun 11, 2009, 12:17:42 PM6/11/09
to
bobh wrote:
>On Jun 11, 10:28�am, bobh wrote:

>> On Jun 10, 6:08�pm, Marshall Barton wrote:
>> > bobh wrote:
>> > >Here at my company everyone has dual monitors and in AccessXP I'm
>> > >trying to get one form to open on one screen as a pop-up(basically a
>> > >new record entry screen). It has a button on it 'Open Reference
>> > >Screen' and when the user clicks that button I want another form
>> > >(query-by-form form) to open on the second screen maximized.
>>
>> > You can use DoCmd.MoveSize to put it on the other monitor.
>> > If the second monitor is to the left or above the primary
>> > monitor, use a corresponding negative position.
>>
>> > After the form has been moved to the other monitor, you can
>> > use DoCmd.Maximize
>>
>> but I don't think it's a guarantee for each user that it's the same
>> primary/secondary monitor setup nor of it's position. Although, I have
>> not seen any setups that are one on top of each other but some users
>> use the rightside monitor as the primary while others use the leftside
>> monitor as the primary. Solving this is not going to be fun, at all.
>>
>> I tried opening the pop up screen first(this is the new record entry
>> screen) and I then moved it over to the secondary monitor and clicked
>> on the 'Open Reference Screen' button. That form(a continuous form)
>> opened maximized on the primary monitor so all was good. But, after
>> making the entry and closing the pop-up form and the reference form
>> and closing Access the next time I opened the application and opened
>> the pop-up it defaulted back to the primary monitor, it did not
>> remember to 'pop-up' in the same position as it did the last time it
>> was opened for that user, which is what I was hoping for and I made
>> sure that I had the pop-up's properties of Auto Center and Auto Resize
>> set to no.
>
>I'm wondering if anybody has a vba function(as I would not have a clue
>as to what that would look like) that will capture the position of a
>form after it's moved and store that information in a table? Then I
>could, on the form open event, read and open the form using those co-
>ordinates that were stored for that user. If that's possible then I
>could open the pop-up form at the last placement that it was closed
>at.


I think you will need to use a local table or custom db
properties to keep track of the form's position/size.
Different Left positions and/or different resolutions could
make every system's position value different.

The position/size can be retrieved using the form's
WindowLeft, etc. properties. Play around with that, but I'm
not sure where/when you want to save the position/size. If
you are doing it all in code, then that's probbly where you
want to get the position/size values. If it's up to the
user to position/size the form, then maybe you can use the
form's Close event to capture the position/size.

--
Marsh

bobh

unread,
Jun 12, 2009, 9:18:23 AM6/12/09
to


for anyone who might be interested this is how I did it.

For the form that I wanted to open it the same spot as when it was
last closed

In the form-open event;
'open the form to the same position that it was last closed at
Set MyDB = CurrentDb()
strSQL = "SELECT * FROM tblPositions" & _
" WHERE tblPositions.UserID='" & Me.bxEnteredBy & "' AND
tblPositions.FormNme='" & Me.Name & "'"
Set MyRec = MyDB.OpenRecordset(strSQL, dbOpenSnapshot)
If MyRec.EOF Then
Exit Sub
Else
DoCmd.MoveSize MyRec!WLeft, MyRec!WTop, MyRec!WWidth, MyRec!
WHeight
End If
MyRec.Close
strSQL = ""


In the form-close event
Set MyDB = CurrentDb()
strSQL = "SELECT * FROM tblPositions" & _
" WHERE tblPositions.UserID='" & Me.bxEnteredBy & "' AND
tblPositions.FormNme='" & Me.Name & "'"
Set MyRec = MyDB.OpenRecordset(strSQL, dbOpenDynaset)
If Not MyRec.EOF Then
MyRec.Edit
With Me
MyRec!WLeft = .WindowLeft
MyRec!WTop = .WindowTop
MyRec!WWidth = .WindowWidth
MyRec!WHeight = .WindowHeight
End With
Else
MyRec.AddNew
With Me
MyRec!UserID = Me.bxEnteredBy
MyRec!FormNme = Me.Name
MyRec!WLeft = .WindowLeft
MyRec!WTop = .WindowTop
MyRec!WWidth = .WindowWidth
MyRec!WHeight = .WindowHeight
End With
End If
MyRec.Update
MyRec.Close
strSQL = ""

bobh.

0 new messages