Feet to Meter Calculation

F

freelancer

In my db I want to insert a room size. The sizes I wish to insert come to me
in both square meters and square feet. I want to create two fields one
showing square feet one showing square meters. I therefore want to be able
to input data in to one field (say square feet) and have the corresponding
size show in the other field (square meters) and vice versa Can this be
done in a db or do I need to create a spreadsheet calculation and insert it
in to the db? How is that done?
Any replies greatly appreciated!

Clive
 
D

Douglas J. Steele

You have to remember that how the data is stored and how it's input aren't
necessarily the same.

Create a form that has two text boxes: one for square meters and one for
square feet. Decide which of the two you're actually going to store in your
table, and bind that text box to the appropriate field in the table. Allow
input into the other text box, but convert (and copy the converted value to
the first text box) in its AfterUpdate event.
 
F

freelancer

Douglas,
thanks for the reply. I do understand the principle of doing the convesion
but don't know how to write SQL etc, so therefore need the Janet & John guide
to doing it. can you help?

Clive
 
D

Douglas J. Steele

Let's assume you decide you're going to store everything in square meters.

On your form, you'd have a text box txtM2, bound to the Area field in the
underlying recordsource. You'd also have a second text box txtFt2.

In the AfterUpdate event of txtFt2, you'd put something like:

Private Sub txtFt2_AfterUpdate()

Me.txtM2 = Me.txtFt2 * 0.09

End Sub

If you want to display both, you could present the equivalent square feet in
the txtFt2 text box anytime you changed it in the txtM2 text box using
something like:

Private Sub txtM2_AfterUpdate()

Me.txtFt2 = Me.txtM2 * 10.96

End Sub

You'd also want to put that same calculation in the form's Current event, so
that it would display both anytime you moved to a new row.
 

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