sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Kevin Myers's Avatar

Units Conversion in Data Entry Field on a Form


Question posted by: Kevin Myers (Guest) on November 13th, 2005 12:57 AM
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



2 Answers Posted
Nikki's Avatar
Guest - n/a Posts
#2: Re: Units Conversion in Data Entry Field on a Form

Kevin Myers wrote:[color=blue]
> 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
>
>
>[/color]
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
John Winterbottom's Avatar
John Winterbottom November 13th, 2005 12:57 AM
Guest - n/a Posts
#3: Re: Units Conversion in Data Entry Field on a Form

"Kevin Myers" <KevinMyers@austin.rr.com> wrote in message
news:10d4pph3v1d733b@corp.supernews.com...[color=blue]
> 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.[/color]
Therefore,[color=blue]
> I don't believe that I can use a bound text box to support the entry of[/color]
data[color=blue]
> for this field. I could use an expression to compute the value for[/color]
display[color=blue]
> 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[/color]
in[color=blue]
> the corresponding database field. How can this be accomplished?
>[/color]


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.


 
Not the answer you were looking for? Post your question . . .
196,907 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,907 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors