Converting Weight - Lbs to Tons

J

Judi

Hi, I'm using Access 2003 and XP.

I have a database that records many things, including the weight of chunks
of metal... most of the users of the database put in to total weight in
pounds, which is great, it offers a little more finnesse in measuring the
weight and recording said weights.

I will be adding one user very soon with his own form since he is in a
different division and uses all of the information from the main form and a
little bit more. This new guy is used to entering weight as Tons, not pounds
and I would like to accommodate that preference, but still have the data go
into the same cell in the table.

Can anyone tell me how to:

1) translate the tons into pounds automatically when he enters them
2) keep his view with tons in his form
3) show his weights as pounds in other forms

Basically, I have no power to make him start using pounds instead of tons,
and if the form is not easy enough, he either won't use it or won't use it
right, which defeats the purpose...

Many thanks to all who help on this site, and more specifically, those who
help me.

Please know that I'm still a beginner and need you to talk slowly and use
small words...

Thank you so much!!
 
K

Klatuu

Assuming the weight is store in pounds in the table, this will require two
text boxes. The text box that will be bound to the weight field should be
invisible. The text box the user will actually see and use should be visible.

For example purposes, let's call the unbound text box in tons txtWghtTons
and the bound text box in pounds txtWghtLbs

1 Sort Ton = 2000 pounds.

It will take some coding in a few place to get it work for you.
First, in the current event, you need to populate txtWghtTons for records
that are not new records:

With Me
If Not .NewRecord Then
If .txtWghtLbs = 0 Then
.txtWghtTons = 0
Else
.txtWghtTons = .txtWghtLbs / 2000
End If
End If
End With

You will a reverse of that logic in the After Update event of txtWghtTons so
that when the user enters a weight in tons, it will be converted to pounds.

With Me
.txtWghtLbs = .txtWghtTons * 2000
End With
 
J

Judi

Awesome... as soon as I read "two text boxes" I got the picture...

Thank you very much... now, one more question...

Originally, in the current event was a macro to maximize the form... I took
that out to enter the code, is there a way to make code that will maximize
the form upon opening or something like that? I just deleted the macro since
it was only one line and I could re-create something like that if I had to...
This is not my database originally, I inherited it.

Thank you for your help!!
 
J

John W. Vinson

Originally, in the current event was a macro to maximize the form... I took
that out to enter the code, is there a way to make code that will maximize
the form upon opening or something like that? I just deleted the macro since
it was only one line and I could re-create something like that if I had to...
This is not my database originally, I inherited it.

Just add a line

DoCmd.Maximize

in the Current event code.
 
J

Judi

Wow, yes, I am glad we don't have to deal with all that... once a building is
designed and we have the weight, it's either pounds or tons, and I'm done!!

Keep up the good work...
 

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