472,342 Members | 1,438 Online

# 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 12695
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
8,832 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
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,511 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