Thanks Alex. You put me on the right track to overcome the problem. I
actually wrote some code in a module to return the required parameters and
then set the position of both the form and toolbar in the On Open event.
Since I couldn't find anything on it in the forum, I thought that it might
help someone else if I post the code I used.
The following code to get the parameters:-
Sub Form_And_ToolBar_Positions()
'Use this sub in a module to identify the position of
'the form and toolbar
Dim frmProduct As Form
Dim objTBar As Object
Set frmProduct = Forms![Product Details]
With frmProduct
MsgBox "Form Name: " & .Name & Chr(13) & _
"WindowLeft: " & .WindowLeft & Chr(13) & _
"WindowTop: " & .WindowTop & Chr(13) & _
"WindowHeight: " & .WindowHeight & Chr(13) & _
"WindowWidth: " & .WindowWidth
End With
Set objTBar = CommandBars("FilterData")
With objTBar
MsgBox "Tool Bar Name: " & .Name & Chr(13) & _
"Tool Bar Top: " & .Top & Chr(13) & _
"Tool Bar Left: " & .Left
End With
End Sub
The following code in the On Open event:-
Private Sub Form_Open(Cancel As Integer)
'On Open code for the form to position form and toolbar
Dim objTBar As Object
Me.Move Left:=2910, Top:=200, Width:=11085, Height:=8715
Set objTBar = CommandBars("FilterData")
With objTBar
.Top = 151
.Left = 606
End With
End Sub
One little glitch. The value for the top of the form may have to be adjusted
in the on open event because it appears to measure from the bottom of any
toolbars before they are closed due to the Forms Toolbar property instead of
measuring it after the toolbars are closed.
--
Regards,
OssieMac
Alex Dybenko said:
Hi,
don't know if you can really lock the position, but I would try to save
commadbar Left and Top properties on form close and then set it to saved
values on form open
--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com