Control Properties in Design Mode

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a form (frmDesignInfo) that I use as a reference while I'm
designing other forms. It is based on simple calculations such as adding the
top value and the height to give me the bottom y coordinate of a control.

At the moment, I have to copy and paste the top value/height into my
reference form, but I was wondering if there was a way I could
programmatically pass these values to frmDesignInfo for the selected control
in the form being designed?
 
You need both frmDesignInfo and the form (MyForm) you are working on open at
the same time. Put the following code in the Click event of MyForm:
Dim strInput As String
strMsg = "What Is The Name Of The Control?"
strInput = InputBox(Prompt:=strMsg)
Forms!FrmDesignInfo!TopValue = Me(StrInput).Top
Forms!FrmDesignInfo!HeightValue = Me(StrInput).Height
Me.Visible = False

Note1: Assumes the name of the textboxes on frmDesignInfo are TopValue and
HeightValue.
Note2: You need a button on FrmDesignInfo with the following code in the
Click event:
Forms!MyForm.Visible = True
 
Back
Top