Connecting Tech Pros Worldwide Forums | Help | Site Map

Units Conversion in Data Entry Field on a Form

Kevin Myers
Guest
 
Posts: n/a
#1: Nov 13 '05
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




Nikki
Guest
 
Posts: n/a
#2: Nov 13 '05

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
Guest
 
Posts: n/a
#3: Nov 13 '05

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.


Closed Thread