Form Position

  • Thread starter Thread starter Steven
  • Start date Start date
S

Steven

I want to double click in a form field and have another
small form open on top just above the field I double
clicked. The main form has many fields I want to do this
from so the position of the form opening on the double
click will be dependent on the field I double click. The
second form is small. About 2inches by 2inches. How do
you control the postion?

Thanks,

Steven
 
I want to double click in a form field and have another
small form open on top just above the field I double
clicked. The main form has many fields I want to do this
from so the position of the form opening on the double
click will be dependent on the field I double click. The
second form is small. About 2inches by 2inches. How do
you control the postion?

Thanks,

Steven

Did you want the small form opened in Dialog?
Add a new procedure to the Main form's code sheet:

Public Sub OpenSmall(Position As String)
DoCmd.OpenForm "frmSmall", , , , , acDialog, Position
End Sub
=============

Code the Double-click event of each control that you wish to open the
small form:

OpenSmall Me![ControlNameHere].Left & "," & Me![ControlNameHere].Top


Code the Small form's Load event:
(Watch the line wrap. The DoCmd.MoveSize should all be on one line.)

Private Sub Form_Load()
DoCmd.MoveSize Left(Me.OpenArgs, InStr(Me.OpenArgs, ",") - 1),
Mid(Me.OpenArgs, InStr(Me.OpenArgs, ",") + 1)
End Sub

The small form will open just above the calling control.
There must be space above the control for the small form.
If you don't want to open the form in dialog, just omit the 'acDialog'
but keep the comma position.
 
I want to double click in a form field and have another
small form open on top just above the field I double
clicked. The main form has many fields I want to do this
from so the position of the form opening on the double
click will be dependent on the field I double click. The
second form is small. About 2inches by 2inches. How do
you control the postion?

Thanks,

Steven

Did you want the small form opened in Dialog?
Add a new procedure to the Main form's code sheet:

Public Sub OpenSmall(Position As String)
DoCmd.OpenForm "frmSmall", , , , , acDialog, Position
End Sub
=============

Code the Double-click event of each control that you wish to open the
small form:

OpenSmall Me![ControlNameHere].Left & "," & Me![ControlNameHere].Top

Code the Small form's Load event:
(Watch the line wrap. The DoCmd.MoveSize should all be on one line.)

Private Sub Form_Load()
DoCmd.MoveSize Left(Me.OpenArgs, InStr(Me.OpenArgs, ",") - 1),
Mid(Me.OpenArgs, InStr(Me.OpenArgs, ",") + 1)
End Sub

The small form will open just above the calling control.
There must be space above the control for the small form.
If you don't want to open the form in dialog, just omit the 'acDialog'
but keep the comma position.

Just a quick correction to make this a bit simpler.
Instead of
OpenSmall Me![ControlNameHere].Left & "," & Me![ControlNameHere].Top

code each of the Control's double-Click event the same, using:

OpenSmall Me.ActiveControl.Left & "," & Me.ActiveControl.Top

This way you won't have to explicitly write each control's name.
 
Back
Top