converting to grams in a table from a form

lakshmi_pili

Registered User.
Local time
Today, 21:30
Joined
May 9, 2001
Messages
10
Hi,

I have this form which contains a table with fields that they can enter in ounces, another field for pounds, and another for kilograms. I also have another field which is calles convt_grams.

What I would like to do is allow the user to enter in ounces, lbs, or Kg, and the database to automatically convert to grams, and add it to that conv_grams field.

I have tried doing it in the query (I created one), and then tried the form by building an event, but have not been successful. This is an example of what I am doing on the form: =[Weight in Lbs]*453.592

Can anybody tell me what I am doing wrong?

Thanks you so much!!!
 
So are you saying that you don't need to store anything other than grams? If that's the case then the three other text boxes should be unbound in the after update of say Weight In Lbs put Me.txtConv_grams=Me.txtLbs*453.592 You shouldn't store this value if you are saving the other fields but calculate it on the form or in a query as you are doing. You should avoid spaces in field names as access doesn't like them.
 
Thank you for your response. Lets see if I understand correctly what you are telling me. The three boxes where they enter the data should be unbounded, but I should create a "build event" for those unbound boxes that will do the convertion, and make sure that it is under the "after update", so that the convertion gets entered in the Conv_grams field for my table.

Did I get your answer correctly?

Thank you.
 
what I would do is build the form from the quesry instead of the table. It will be easier for you.

If you are using the assistant just select the feilds from your query name instead of the table. If you have already put your calculated field in the query then it will pass, along with the calculation to your form.
 
I am sorry for being dense, but it is not working. I made those three boxes "unbounded" on the form, and then added "Me.[Weight in Grams]=Me.Weigh_in_Oz * (28.3495))" to the after update, but it keeps giving me this error message when I press enter or tab to go the next field:

Microsoft can't find the Macro "me". The macro does not exist.

It is also saving the same value that I entered on that field.

Thank you for any help.
 
You need first to re-name your controls to something other than the field names. Open the property sheet for Weight in Grams click other tab and rename the field to say txtGrams and Weigh_in_Oz to txtOunze in the after update of Weigh_in_Oz put Me.txtGrams = Me.txtOunze * (28.3495)
there are no quotes!
 

Users who are viewing this thread

Back
Top Bottom