469,338 Members | 8,430 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,338 developers. It's quick & easy.

Convert feet & inches to metres

Have 3 text boxes.

Feet, inches and metres.

As I type in feet then inches, I would like to convert this to metres and place the result in the metres text box as soon as I tab on to the next field.

Can anyone help, please?
Feb 12 '07 #1
6 12297
Michael R
176 100+
Have 3 text boxes.

Feet, inches and metres.

As I type in feet then inches, I would like to convert this to metres and place the result in the metres text box as soon as I tab on to the next field.

Can anyone help, please?
Yes, add this code to both inches and meters text boxes After Update events:

Expand|Select|Wrap|Line Numbers
  1. Me.Meters.Value = Me.Feet.Value * 0.305 + Me.Inches.Value * 0.025
Michael.
Feb 12 '07 #2
ADezii
8,800 Expert 8TB
Have 3 text boxes.

Feet, inches and metres.

As I type in feet then inches, I would like to convert this to metres and place the result in the metres text box as soon as I tab on to the next field.

Can anyone help, please?
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtInches_AfterUpdate()
  2.   'The conversion formatted to 2 decimals places
  3.   Me![txtMeters] = Format(((Nz(Me![txtFeet]) * 12) + Nz(Me![txtInches])) / 39.36, "#,#,#.##")
  4. End Sub
Feb 12 '07 #3
Thank you, Michael.

Calculated field calculates fine now. How do I place the calculated value (now in a text box on a form) back into the underlying table?
Feb 12 '07 #4
ADezii, thank you.
Feb 12 '07 #5
Michael R
176 100+
Calculated field calculates fine now. How do I place the calculated value (now in a text box on a form) back into the underlying table?
You create a field Meters in the underling table and use it in the form as Meters text box control.
Feb 12 '07 #6
NeoPa
32,182 Expert Mod 16PB
It's not a good idea to store two items which are equivalent in the record together. If the Meters control is bound though, but the Feet & Inches controls are not that is a neat facility.
Feb 12 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by HMS Surprise | last post: by
2 posts views Thread by Daniel Kster | last post: by
7 posts views Thread by 一首诗 | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.