title: How to Dynamically keep controls centered (relative position) on an MS Access form?
body: <p>I'm working in Access 2013 and have a number of controls (listboxes, buttons, etc.) that I want to keep centered, as a group, on a form when the form is resized. </p>
  
  <p>Anchoring won't accomplish what I'm looking for because I don't want to lock the controls to the top/bottom/left/right. I want them to stay in the center. </p>
  
  <p>Simply using code like this <em>me.mycontrol.left = myform.Width/2</em> on the form's resize event doesn't do what I'm looking for because it aligns the individual controls to the center. I want the group of controls to be centered. </p>
  
  <p>Is there a way to do this? </p>
  
  <p>EDIT: Here's an example, which may make this clearer.  Suppose I have a 100 x 100 form with two buttons on it. The buttons are 20 units tall and are spaced 10 units apart. They'd have the following positions:</p>
  
  <p>Button1.Top = 25
  (10 unit space starts at 45)
  Button2.Top = 55</p>
  
  <p>If the form is resized to 200 x 200, the controls would have the following positions:</p>
  
  <p>Button1.Top = 75
  (10 unit space starts at 95)
  Button2.top = 105</p>
  
  <p>Ideally, I'd love to turn this into a module, where I just pass it a form and it takes the original position of each control and calculates the new position.</p>
  
  <p>Edit 2: </p>
  
  <p>Here's one failed attempt at it, using my real code, based onthe idea from Krish:</p>
  
  <pre><code>Private Sub Form_Resize()
  
  Dim resizeFactor As Double
  
  resizeFactor = Me.WindowWidth / Me.Width
  
  Me.lstModule.Left = Me.lstModule.Left * resizeFactor
  Me.ctlSubform.Left = Me.ctlSubform.Left * resizeFactor
  Me.Box6.Left = Me.Box6.Left * resizeFactor
  
  End Sub
  </code></pre>