Form position on screen (1 Viewer)

Sess

Registered User.
Local time
Today, 15:22
Joined
Jan 4, 2010
Messages
74
This works very well except for the Send button beside the Properties adjustment. Clicking this will return an error

Error 2467 (The expression you entered refers to an object that is closed or doesn't exist.) in procedure fCurrentForm of VBA Document Form_DcbFormSizer_V3

I like the application it will make placing the screens easier for me - also I like the >> and << button to emulate a Maximize Minimize that is very cleaver.

Should work in 2003 now: (I Hope)
I cant seem to see any other offending events.....:confused:
 

dcb

Normally Lost
Local time
Tomorrow, 00:22
Joined
Sep 15, 2009
Messages
529
Thanks for testing:

Again I cant duplicate the fault.....
Please tell me which line number?

Code:
Private Sub cmdS_PopUp_Click()
          'DoCmd.OpenForm
          Dim bolSet As Boolean
          Dim intBorderstyle As Integer
10        DoCmd.OpenForm fCurrentForm.Name, acDesign
20            bolSet = Me.cPopUp
30                fCurrentForm.PopUp = bolSet
40            bolSet = Me.cAutoCenter
50                fCurrentForm.AutoCenter = bolSet
60            bolSet = Me.cAutoResize
70                fCurrentForm.AutoResize = bolSet
      '        bolSet = Me.cFitToScreen
      '        ''    fCurrentForm.FitToScreen = bolSet
80            bolSet = Me.cModal
90                fCurrentForm.Modal = bolSet
100           intBorderstyle = Me.cmbBorderStyle
110               fCurrentForm.BorderStyle = intBorderstyle
120       DoCmd.OpenForm fCurrentForm.Name
130       Me.SetFocus
End Sub

The thought was initially to use it on 2007 only - thus the reason that i have items that are not in 2003... Now I can make a version that will detect both! Very cool - so thanks again!

Without stepping too far away from its intended purpose, can you think of anything else i should jot in?
 

Sess

Registered User.
Local time
Today, 15:22
Joined
Jan 4, 2010
Messages
74
Line 20
I tried to place a ' on line 20 so it would ignore the line but it returned the same error for line 30 so I did the same for line 30 and line 40 returned the same error...

Thanks for testing:

Again I cant duplicate the fault.....
Please tell me which line number?

Code:
Private Sub cmdS_PopUp_Click()
          'DoCmd.OpenForm
          Dim bolSet As Boolean
          Dim intBorderstyle As Integer
10        DoCmd.OpenForm fCurrentForm.Name, acDesign
20            bolSet = Me.cPopUp
30                fCurrentForm.PopUp = bolSet
40            bolSet = Me.cAutoCenter
50                fCurrentForm.AutoCenter = bolSet
60            bolSet = Me.cAutoResize
70                fCurrentForm.AutoResize = bolSet
      '        bolSet = Me.cFitToScreen
      '        ''    fCurrentForm.FitToScreen = bolSet
80            bolSet = Me.cModal
90                fCurrentForm.Modal = bolSet
100           intBorderstyle = Me.cmbBorderStyle
110               fCurrentForm.BorderStyle = intBorderstyle
120       DoCmd.OpenForm fCurrentForm.Name
130       Me.SetFocus
End Sub

The thought was initially to use it on 2007 only - thus the reason that i have items that are not in 2003... Now I can make a version that will detect both! Very cool - so thanks again!

Without stepping too far away from its intended purpose, can you think of anything else i should jot in?
 

Cwittmaack

Registered User.
Local time
Today, 18:22
Joined
Nov 3, 2009
Messages
70
Sorry Am a little behind just got your last Db.zip
 
Last edited:

Cwittmaack

Registered User.
Local time
Today, 18:22
Joined
Nov 3, 2009
Messages
70
dcb

i get the same error and it is on line 20 when i select Send button on Properties, as far as i know i see no other things that need to be added to this.

Again thanks
 

sacacompany

Member
Local time
Tomorrow, 03:22
Joined
Dec 28, 2022
Messages
31
Turn the form's Auto Center property off, or set it to no (whichever applies) and use the Move method on the Load event of the form.

Me.Move(left, top, width, height)
i tried to get the location from this vba.....Me.WindowTop, Me.WindowLeft, Me.WindowHeight, Me.WindowWidth...it gives ...1680 -4332 10140 22800....but when i use them in ...DoCmd.MoveSize -984, -4776, 11892, 22704...got an error msg that -ve values not allowed
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:22
Joined
Feb 28, 2001
Messages
27,364
That is a misuse of the MoveSize method. You don't move relative to where your form is located. You move relative to where your WINDOW is located.


The first two arguments are absolute coordinates, not relative. You are attempting to put a portion of the form off-screen (or partially out of the window) when using negative numbers.

You must specify the left and top values for the form relative to the left and top corner of the window holding the form (the corner is 0,0). Find where you are in the window first, then add or subtract the distance you wanted to move, then make the .MoveSize call with the computed position relative to the WINDOW corner, not from the form's current corner.

If you want the window's corner itself to be moved, you have to start playing with API calls to determine window position and sizing via Windows calls, not Access properties. This linked thread discusses the API process.


Remember that a form lives in a WINDOW and the window lives on a SCREEN. Layers within layers.
 

Users who are viewing this thread

Top Bottom