Connecting Tech Pros Worldwide Help | Site Map

Units Conversion in Data Entry Field on a Form

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 11:57 PM
Kevin Myers
Guest
 
Posts: n/a
Default Units Conversion in Data Entry Field on a Form

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  
Old November 12th, 2005, 11:57 PM
Nikki
Guest
 
Posts: n/a
Default 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
  #3  
Old November 12th, 2005, 11:57 PM
John Winterbottom
Guest
 
Posts: n/a
Default 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.


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

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 220,840 network members.