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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where to start?

Status
Not open for further replies.

bcblair

MIS
Feb 17, 2000
45
0
0
US
I am going to try a form. I will try to explain.

It deals with concrete mixes. Concrete mixes are called mix designs, they are like recipes for concrete. Each Mix Design equals one cubic yards They consists mainly of cement, water, sand, and stone. We have 40 plants that have mix designs. I want to make a form that will let me enter part of the data and have it calculate the rest and then be able to save it in the database.

The data is in several files listed below:

Plants=plant info

Plant Materials=material characteristics at each plant, specific gravity is neded for mix designs

Mix Designs=All the mix designs.


The three file are related mainly by the plant number.

To design a mix you need to be able to enter the pounds of each material except sand. The form needs to calculate the cubic feet(27 equals a yard) each material takes up. This is done by taking the weight and dividing by a constant which is 62.4 and the materials specifioc gravity from the plant materials database, which is about 2.7. Then the form needs to add up those materials volume and subtract them from 27 cubic feet. What is left will be the sand. So we want it to take the amount of volume for sand and calculate how many pounds of sand are needed to make a yard. Example


Cement 564/62.4(constant)/3.15(Specific Gravity from Plant Materials DB) = 2.87 ft3
Stone 1800/62.4/2.75=10.49 FT3
Water 325/62.4/1=5.21 ft3

These volumes add up to 18.57 ft3: 27-18.57=8.43 ft3 of sand

Sand 8.43ft3 times 62.4 times 2.63 = 1383 pounds of sand.

I hope someone can understand my writing. I have tried before. but have never been able to get it all working.

1. Is it possible?
2. How should it be structured? Should I set uo a query? Should I use subforms?
3. How do I make sure after it calculates that I can save it in the database.

I don't expect to get all answers right away, but I don't want to go way down the wrong path and find out I took a wrong turn at the beginning. I expect to have to comebnack with questions as I run into problems



 
Hi,

My recomendation is to provide four text boxes and a button that says "Calculate", or whatever you like.

Three of the text boxes provide a place for the user to enter the amount of cement, water, and stone.

The fourth text box would be read-only (disable it), and would display the calculated amount of sand.

You would execute the button's OnClick procedure when it is pressed, and it would contain all the code for calculating the amount of sand. It seems rather straightforward.

Storing the data in the table is easy too, but the way you do it will depend on whether you use bound or unbound text boxes. My preference is to use unbound text boxes, but that is really just a style issue. If you go with unbound text boxes, you can store the data in the table with the following code.

Dim db as DAO.database
dim recset as DAO.recordSet

Set db = Currentdb
Set recset = db.OpenRecordSet("tablename", dbOpenDynaset)

recset.AddNew
recset!cement = Me.cement
recset!water = Me.water
recset!stone = Me.stone
recset!sand = Me.sand
recset.Update

You can also check to make sure that the user entered data in the cement, water, and stone text boxes in the OnClick procedure. If any of them are empty you can return an error.

If you want to use bound text boxes, you can use the following command to save the data.

DoCmd.RunCommand acCmdSaveRecord

I hope this helps you out and you get it working.

dz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top