By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 3,094 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

Make Average follow record

P: 12
Ok this works great, but which part of it can I change to make the "Average of the 10" stay with the current record. These averages are currently "logged" by hand, if I pull the records into a report, it will auto-log and no more human error

Private Sub cmdCalc_Click()
Dim tempTotal As Double
Dim tempVal As Double
Dim iCount As Integer
Dim i As Integer
tempTotal = 0
iCount = 0
For i = 1 To 10
tempVal = Nz(Me.Controls("Batch#" & i), 0)
If tempVal <> 0 Then
tempTotal = tempTotal + tempVal
iCount = iCount + 1
End If
Next i
Me.txtAverage = tempTotal / iCount
Nov 15 '06 #1
Share this Question
Share on Google+
3 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Create a field on the relevant table to store the value and then go to the txtAverage control in the form and in the properties window under the data tab set the control source to this field.

This will store the value with the record.

Mary

Ok this works great, but which part of it can I change to make the "Average of the 10" stay with the current record. These averages are currently "logged" by hand, if I pull the records into a report, it will auto-log and no more human error

Private Sub cmdCalc_Click()
Dim tempTotal As Double
Dim tempVal As Double
Dim iCount As Integer
Dim i As Integer
tempTotal = 0
iCount = 0
For i = 1 To 10
tempVal = Nz(Me.Controls("Batch#" & i), 0)
If tempVal <> 0 Then
tempTotal = tempTotal + tempVal
iCount = iCount + 1
End If
Next i
Me.txtAverage = tempTotal / iCount
Nov 16 '06 #2

P: 12
Solved, thank you again :)
Nov 16 '06 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
Solved, thank you again :)
No problem.

Glad to help.
Nov 16 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.