Number feild for weight

K

KAnoe

I need to set up a feild that the user will use to input weight in the
following format. 16lbs 9.5oz. I would like to know if I could have it set up
like this. I would like to use this feild at a later date to add up the total
weight. Can this be done.

Thanks

Keith
 
K

Ken Snell \(MVP\)

May I suggest that you do one of the following:

1) Use one field for pounds and one for ounces (two separate fields). You
can always concatenate the two values into one string for display purposes.
User uses two separate controls to enter the values.

2) Use one field to store the total ounces. User uses two separate controls
to enter the values, and your form calculates the total ounces and stores
the value in the field. You can use a query to calculate the separate pounds
and ounces for display purposes.

3) Use one field to store the total pounds. User uses two separate controls
to enter the values, and your form calculates the total pounds and stores
the value in the field. You can use a query to calculate the separate pounds
and ounces for display purposes.
 
K

KAnoe

Thanks Ken. It looks to me that the best one would be 2). So that at the end
on a year I can have a report that would add up the total and show the weight
in Lbs and Oz. How would I setup the two separate controls to enter the
values?

Thanks for you time and help.
 
K

Ken Snell \(MVP\)

Create a form that is bound to a query that returns all fields from the
table. Put two unbound textboxes on the form - one for pounds, one for
ounces. Then use the form's BeforeUpdate event to run code that calculates
and stores the value in ounces:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.NameOfTotalOuncesField.Value = Nz(Me.PoundsTextbox.Value, 0) _
* 16 + Nz(Me.OuncesTextbox.Value, 0)
End Sub

Note that this setup will not be visibly desirable if you use a "continuous
forms" view for the form -- it's meant for a "single forms" view. The reason
is that the unbound textboxes will show the same values in all records that
are visible as you type in values, which may be disconcerting to the user.
 
K

KAnoe

Will this work as a report. What I'm trying to do is set up a db for my BASS
club. I would like to use it for our tournaments so enter the weights for
each tournaments and run a report to see the club standings. So that after 3
tournaments it would total all the members weight and give the clube
standings.
 
K

KAnoe

Would it be better to do the weight in tenths?

KAnoe said:
Will this work as a report. What I'm trying to do is set up a db for my BASS
club. I would like to use it for our tournaments so enter the weights for
each tournaments and run a report to see the club standings. So that after 3
tournaments it would total all the members weight and give the clube
standings.
 
K

Ken Snell \(MVP\)

For a report, you add two calculated fields to the query that is the
report's RecordSource, and those two calculated fields convert the total
ounces to the pounds and ounces values. For example:

SELECT TableName.*, (Nz(TableName.TotalOunces, 0)\16) AS PoundValue,
(Nz(TableName.TotalOunces, 0) - (Nz(TableName.TotalOunces, 0)\16)*16)
AS OunceValue
FROM TableName;

You can decide to what accuracy (tenths, units, hundredths, etc.) you want
to use for your data without affecting how the queries will 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