Good morning :-)
I am currently struggling with an operation that might be pretty simple to solve. I am at the moment thinking about the creating the following solution:
A user enters a value x between 0 and 1 into a field and clicks a button.
The vba code should then loop through all FILTERED items of the current recordset and sum up their population, until the value the user has entered is reached.
Once this point has reached, all records that have not been summed up yet, should be filtered out.
I don't know if my wording is understandable, but would really appreciate any help for generating the necessary code/solution.
best regards
Code:
Private Sub sumup_Click()
Dim popArray() As Integer
Dim RecordCount As Integer
RecordCount = DCount("[population]", "[main]")
ReDim popArray(RecordCount)
popCounter = 0
While popCounter < 0.02
popCounter = popCounter + ([population] / DSum("[population]", "[main]"))
Wend
End Sub