Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to multiply a data field by a user-entered amount?

Status
Not open for further replies.

cwhite23

Technical User
Sep 17, 2003
66
US
Help! I must be missing something simple! How do you tell access to take data from a field and multiply it by a user-entered amount? I'm working on a production planning database, and am stumped!
 
Depends on exactly how the user is entering the amount but here's one way
Code:
PARAMETERS [Enter the Amount] Long;
Select (fld1 * [Enter the Amount]) As [Multiplied Amount]
From etc. ...
 
You don't give much description here, I'm assuming the user is entering data on the form in a textbox. I'm assuming the other field is somewhere else on the form.

will call your data from field as intYourData
will call the user entered data as intEnteredData

Now you have an option, 'after update' of the user entered field.

Me!intYourData = Me!intYourData * Me!intEnteredData

or when they click a command button

Me!intYourData = Me!intYourData * Me!intEnteredData

Remember both of these fields must be set to numeric in the table, or you will receive an error.

You may need to set focus to the fields 1st before calculating them.

If you have anymore problems, try to be a little more descriptive. And I'll do my best to answer the question.

Carl



AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
What I'm trying to do is have the user enter in a product number and a quantity to be produced. The system will then pull the production bill for the item, and multiply the base quantity for each of the components by the quantity entered by the user to give a total amount of components needed to produce the stock. Hope this isn't too confusing! The problem I'm running into is how to have a field where the user can enter the quantity to be produced, and have the system multiply the data by that amount. Any ideas?.
 
Let me understand...

You have a form, they enter the product # (xyz123)
Then they enter how many they want. ( 4 )

They press a button, and?
What is the production bill?
A new form opens, or a subform displays.

The production bill, I'm guessing is basically like a parts list needed to build the product.

Do you have fields in the prod. bill to hold the total amount needed for each component?

If this is the basic setup, you have a few options.
Let me if I'm on the right track!


Carl

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top