|
|
hello to all
I have an application with about 40 forms and I want to control the size and position of each of these forms when it opens. I currently do this with code in each form's Open event like... DoCmd.MoveSize 150, 250, 1100, 1850
But, I've noticed that there are only 5 different MoveSize settings spread among all 40 forms. I'd like a way to put these moveSize values in a table, then have each form look up its values when its Open event is executed. As a very rusty coder, could some kind soul help me with this?
Much thanks Becky
|
|
On Sat, 27 Dec 2008 14:15:00 -0800, Becky <Becky[ at ]discussions.microsoft.com> wrote:
In each Form_Open event write: PositionMe Me
In a standard module write: Public Sub PositionMe(frm As Form) Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("tblScreenPositions", dbOpenSnapshot) rs.FindFirst "FormName='" & frm.Name & "'" If rs.NoMatch Then MsgBox "Aarrcchhh, you did not enter coordinates for form " & frm.Name Else DoCmd.MoveSize rs!Right, rs!Down, rs!Width, rs!Height End If rs.Close Set rs = Nothing End Sub
Create a new table named tblScreenPositions, with fields FormName, text255, required, PK Right, number, long integer, required Down, number, long integer, required Width, number, long integer, required Height, number, long integer, required
-Tom. Microsoft Access MVP
[Quoted Text] >hello to all > >I have an application with about 40 forms and I want to control the size and >position of each of these forms when it opens. I currently do this with code >in each form's Open event like... > DoCmd.MoveSize 150, 250, 1100, 1850 > >But, I've noticed that there are only 5 different MoveSize settings spread >among all 40 forms. I'd like a way to put these moveSize values in a table, >then have each form look up its values when its Open event is executed. As a >very rusty coder, could some kind soul help me with this? > >Much thanks >Becky
|
|
Perfect! Exactly what was needed. Thanks, Tom.
"Tom van Stiphout" wrote:
[Quoted Text] > On Sat, 27 Dec 2008 14:15:00 -0800, Becky > <Becky[ at ]discussions.microsoft.com> wrote: > > In each Form_Open event write: > PositionMe Me > > In a standard module write: > Public Sub PositionMe(frm As Form) > Dim rs As DAO.Recordset > Set rs = CurrentDb.OpenRecordset("tblScreenPositions", > dbOpenSnapshot) > rs.FindFirst "FormName='" & frm.Name & "'" > If rs.NoMatch Then > MsgBox "Aarrcchhh, you did not enter coordinates for form " & > frm.Name > Else > DoCmd.MoveSize rs!Right, rs!Down, rs!Width, rs!Height > End If > rs.Close > Set rs = Nothing > End Sub > > Create a new table named tblScreenPositions, with fields > FormName, text255, required, PK > Right, number, long integer, required > Down, number, long integer, required > Width, number, long integer, required > Height, number, long integer, required > > -Tom. > Microsoft Access MVP > > > >hello to all > > > >I have an application with about 40 forms and I want to control the size and > >position of each of these forms when it opens. I currently do this with code > >in each form's Open event like... > > DoCmd.MoveSize 150, 250, 1100, 1850 > > > >But, I've noticed that there are only 5 different MoveSize settings spread > >among all 40 forms. I'd like a way to put these moveSize values in a table, > >then have each form look up its values when its Open event is executed. As a > >very rusty coder, could some kind soul help me with this? > > > >Much thanks > >Becky >
|
|
|