Moving controls dynamically

  • Thread starter Stephen @ ZennHAUS
  • Start date
S

Stephen @ ZennHAUS

Hi guys and gals

I am wondering if it is possible to move controls on a form by changing the
left and top properties based on options that are chosen in a combo box.

Currently I have a number of labels and check boxes on the form all of which
have the Visible property set to False while the check boxes also have the
Enabled property set to False.

When the user chooses an item in the combo box, I have code that sets left
and top properties of each label and check box as well as enabling them and
making them visible.

The code I have used is as follows:

lblPos1.Left = "4.023"
lblPos1.Top = "5.265"
lblPos1.Visible = TRUE

I have also tried putting the positions in without the quotes around, but
both results are the same. All of the controls end up in the top left
corner of the screen stacked on top of each other.

I am using Access 2003.

Cheers

Stephen @ ZennHAUS
 
D

Dirk Goldgar

Stephen @ ZennHAUS said:
Hi guys and gals

I am wondering if it is possible to move controls on a form by changing
the left and top properties based on options that are chosen in a combo
box.
Yes.

Currently I have a number of labels and check boxes on the form all of
which have the Visible property set to False while the check boxes also
have the Enabled property set to False.

When the user chooses an item in the combo box, I have code that sets left
and top properties of each label and check box as well as enabling them
and making them visible.

The code I have used is as follows:

lblPos1.Left = "4.023"
lblPos1.Top = "5.265"
lblPos1.Visible = TRUE

I have also tried putting the positions in without the quotes around, but
both results are the same. All of the controls end up in the top left
corner of the screen stacked on top of each other.

When you assign values to controls' positional properties (such as Left,
Top, and Width) using VBA code, you must specify the values in twips -- one
twentieth of a point, or 1/1440 of an inch. For example, 4.023 inches =
5793 twips.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top