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!

Loop through Tagged text boxes on form??

Status
Not open for further replies.

joebox888

Technical User
Jun 17, 2011
24
0
0
IE
Hi... I'm new to access! Hopefully someone can help.

My DB has one table, Its not very big however I have roughly 50 fields in it.
32 of the fields are named x1, x2, x3, x4, ....x32(corresponding to 32 text boxes on my form)
I have Tagged each text box with "T". How would i work it so I can only get the average(or std_dev) of only the tagged text boxes that have a numeric value greater than 0.00???

I realize there are a few ways of doing this however im struggling with it. Here's what i think...
Loop through each text box, If greater than 0.00 then increment a count(say C) then at the end divide my total by (32 - C)?

Or should I do this from the Table instead of the form? through a query? or how could i phrase DAvg so the criteria would pick out the nonNull Tagged textbox values??
Please help!!!
 

Just an idea....

What do those x1, x2, x3, x4, ....x32 represent?
Are all of them always filled in (do ALL of them have values)?

If not, you may want to re-think your DB design and go with:
tbl_Main
ProjectID
....

tbl_Other[tt]
ProjID X_Value
2 123
2 50
2 75
3 456
3 765
3 2[/tt]

This way getting an average of X_Values for ProjectID = 2 (or 3, or whatever) is simple by:
[tt]SELECT Average(X_Value) from tbl_Other WHERE ProjID = 2[/tt]

Have fun.

---- Andy
 
Joe,
I do not get it. I have shown you several times how to do this, but do not understand why you won't just do it as I explained. But bottom line is you normalize the data with a big union query, and the rest is trivial. Basically your data would end up in the format that Andy suggests and then you just would do something similar to his query. See previous answer
Thread701-1653035
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top