By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,854 Members | 1,871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,854 IT Pros & Developers. It's quick & easy.

Units Conversion in Data Entry Field on a Form

P: n/a
Hello,

Have yet another problem on a form that has me stumped. In a table that I
am working with, the values for one of the fields are stored in meters.
However the values that are supplied for data entry are in feet. Therefore,
I don't believe that I can use a bound text box to support the entry of data
for this field. I could use an expression to compute the value for display
in the text box as follows:

[TOTAL_DEPTH]*100/(12*2.54)

But then the text box would represent a calculated field, and become
non-editable, right? The user needs to be able to enter values in this
field, and have them converted back from feet to meters prior to storage in
the corresponding database field. How can this be accomplished?

Thanks again,
s/KAM

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Kevin Myers wrote:
Hello,

Have yet another problem on a form that has me stumped. In a table that I
am working with, the values for one of the fields are stored in meters.
However the values that are supplied for data entry are in feet. Therefore,
I don't believe that I can use a bound text box to support the entry of data
for this field. I could use an expression to compute the value for display
in the text box as follows:

[TOTAL_DEPTH]*100/(12*2.54)

But then the text box would represent a calculated field, and become
non-editable, right? The user needs to be able to enter values in this
field, and have them converted back from feet to meters prior to storage in
the corresponding database field. How can this be accomplished?

Thanks again,
s/KAM

I have solved this issue before. Have an unbound textbox for entering in
the Feet/inches, make the metric textbox hidden and add code to the
afterupdate event of the Imperial text box.

You will also need to convert the Metric into Imperial to display the
current database value in the text box.

sub txt_feet_afterupdate()

if isnull(me!txt_feet) then
me!txt_metric=Null
elseif not isnumeric(me!txt_feet)
msgbox "You must enter a valid number",vbokonly,"Data Input"
me!txt_feet=Null
me!txt_feet.setfocus
else
me!txt_metric=me!txt_feet*100/(12*2.54)
endif

end sub

Check the code, I have not written anything in Acces for some time.

Gavin
Nov 13 '05 #2

P: n/a
"Kevin Myers" <Ke********@austin.rr.com> wrote in message
news:10*************@corp.supernews.com...
Hello,

Have yet another problem on a form that has me stumped. In a table that I
am working with, the values for one of the fields are stored in meters.
However the values that are supplied for data entry are in feet. Therefore, I don't believe that I can use a bound text box to support the entry of data for this field. I could use an expression to compute the value for display in the text box as follows:

[TOTAL_DEPTH]*100/(12*2.54)

But then the text box would represent a calculated field, and become
non-editable, right? The user needs to be able to enter values in this
field, and have them converted back from feet to meters prior to storage in the corresponding database field. How can this be accomplished?

If it's an option to do so, change the table structure to hold the raw data
in feet. The convert the output to meters whenever you need to. Storing
calculated information is generally not a good idea.
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.