444,027 Members | 1,261 Online
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

# How To Move a Command Button On A Form?

 100+ P: 132 I have a command button on a form. When the command button is clicked, I would like to relocate it on the form. I thought I would do so using the LEFT and TOP properties, but I'm getting no love. The code looks something like this: Me.[BtnClose].left = 2.1222 the posistion number does not seem to make a difference as the button always appears to the far left....what am I missing?? Aug 7 '07 #1
6 Replies

 Expert Mod 10K+ P: 12,383 You may be seeing inches in your properties but all the controls are measured in twips. The help files will give you the conversion rate for twips to inches, which is what I assume is what you're using. I think it's something like 14 twips to an inch. Aug 8 '07 #2

 Expert 2.5K+ P: 3,532 Not quite, Rabbit! It's 1440 twips/inch! So I suspect that the code is working, it's just difficult for the human eye to percieve the button moving 0.0014737 of an inch! My question is "Why?" Linq ;0)> Aug 8 '07 #3

 Expert Mod 10K+ P: 12,383 I was way off... twip: Unit of measurement that is equal to 1/20 of a point, or 1/1,440 of an inch. There are 567 twips in a centimeter. Aug 8 '07 #4

 Expert 5K+ P: 8,669 I have a command button on a form. When the command button is clicked, I would like to relocate it on the form. I thought I would do so using the LEFT and TOP properties, but I'm getting no love. The code looks something like this: Me.[BtnClose].left = 2.1222 the posistion number does not seem to make a difference as the button always appears to the far left....what am I missing?? 'To Move the Command Button 2 inches from the Left of the Form, '2 inches from the Top of the Form, resize it to 4 inches in Width, 'resize it to 2.5 inches in Height Expand|Select|Wrap|Line Numbers Private Sub cmdTest_Click() 'Easier to enter measurements in inches Const INCHES_TO_TWIPS = 1440     With Me![cmdTest]     .Left = 2 * INCHES_TO_TWIPS     .Top = 2 * INCHES_TO_TWIPS     .Width = 4 * INCHES_TO_TWIPS     .Height = 2.5 * INCHES_TO_TWIPS   End With End Sub Aug 8 '07 #5

 100+ P: 132 'To Move the Command Button 2 inches from the Left of the Form, '2 inches from the Top of the Form, resize it to 4 inches in Width, 'resize it to 2.5 inches in Height Expand|Select|Wrap|Line Numbers Private Sub cmdTest_Click() 'Easier to enter measurements in inches Const INCHES_TO_TWIPS = 1440     With Me![cmdTest]     .Left = 2 * INCHES_TO_TWIPS     .Top = 2 * INCHES_TO_TWIPS     .Width = 4 * INCHES_TO_TWIPS     .Height = 2.5 * INCHES_TO_TWIPS   End With End Sub THAT DID THE TRICK!!! THANKS FELLAS!! Aug 8 '07 #6

 Expert 2.5K+ P: 3,532 Glad we could help! Linq ;0)> Aug 8 '07 #7