Search code examples
ms-accesscommandbutton

How do i control position of command button on an access form?


I copied a CLOSE FORM command button from an Access template that has an image embedded in the button. When in development mode, i align the template-copied button with command buttons i created myself. my command buttons also have an embedded image. But when i "run" the form, the template-copied button text appears in area of the form that i do not expect it to. it appears much farther to the right than its placement in development mode. The images from the copied button don't look the same as images i can embed when i assign the property myself. i was hoping to not have to use code for the copied button. Why does copied button not stay in position that it appears in dev mode? thanks for any help in advance.

i have searched for explanations related to access templates to no avail. i have found examples of code that allows to specify how/where button should appear. not all examples were specific to Access/VBA though. trying to avoid coding the button, as i want it to appear on every form for the same "look & feel". and i am hoping to use other buttons from other Access template if i can figure out this problem. the CLOSE FORM button was copied from Access Sales Call sample database template. The graphic on the button is different than the image i can apply when defining button myself. The copied button is the third one down (in a vertical stack) of 3 command buttons. Buttons 1 & 2 i manually defined. they all have the same value of 6.5" in the LEFT property. the TOP properties are, respectively, 0.5", 0.8", and 1.1".

the image and text for command buttons 1 & 2 display correctly when the form is run. however, even though button 3 is aligned when in dev mode, when the form is run, the image and text for button 3 are way to the right of #1 and #2. Vertically, the text appears under #1 & #2, but the horizontal position is way off. It almost appears to be the width of button #1, times two. Buttons #1 & #2 are the same width.

Buttons in DEV mode:

buttons in DEV mode

Buttons in RUN mode:

buttons in RUN mode

CLOSE form button properties:

CLOSE form button properties


Solution

  • You have cut off the bottom part of the Properties pane.

    But check the setting for Horisontal Anchor that it is set to: Left.