Entering a value in a field and displaying converted value in anot

G

Guest

Hi.
I am designing a front end form for entering geological well data. I have
to enter depth measurements, but the information we acquire can be in feet or
metres. Although it is not difficult to manually calculate the conversions,
I would like to enter the measurents into one of the fields and for the other
field to be automatically filled with the converted value.
So if I enter a depth of 300 into the depth in feet field, the depth in
metres field will take the value of 300, multiply it by 0.3048 and display
the value of 91.44.
Likewise, if I enter a value in the metres field, the converted value will
be displayed in the feet field.
I'm sure this can be done, but I'm not quite sure how? Can anyone help
please?
 
G

Guest

One way would be to call a macro after update of the object. The macro
condition checks the other object for data and uses action of SetValue if it
is empty.
So if there was data and you needed to change it you would first have to
delete data in one and then change in the other.
 
G

Guest

I have done a very similar thing with volume in our system, allowing users to
enter in either cubic feet (in one field) or cubic metres (in another field)
and doing whichever conversion is required.

Taking your situation: in the AfterUpdate property of the DepthFeet control
(field), create the following event procedure:

Private Sub DepthFeet_AfterUpdate()
Me.DepthMetres = Me.DepthFeet * 0.3048
End Sub

and you can do a similar thing in the DepthMetres field, switching the
wording and the conversion factor around.

I'm usually asking questions here - it's nice to be able to give an answer
for once!!
CW
 

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