473,498 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Make Average follow record

12 New Member
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
3 1267
MMcCarthy
14,534 Recognized Expert Moderator MVP
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
Del Cagle
12 New Member
Solved, thank you again :)
Nov 16 '06 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
Solved, thank you again :)
No problem.

Glad to help.
Nov 16 '06 #4

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

Similar topics

8
1683
by: Alex | last post by:
My table is laid out as such: ID (int) What (varchar 20) TimeStamp (smalldatetime) ------- ------------- --------------- 73 Start ...
2
2784
by: Karen | last post by:
I inserted this statement and it worked great for the customers that have no payment history, but for the customers that have a history and an open invoice, it still used today's date in the mix...
2
13585
by: Wayne Aprato | last post by:
I've read most, if not all, of the posts on moving average and still can't find a simple solution to my problem (if a simple solution exists!) I have a table with 2 fields: Hours and Injuries. I...
6
3125
by: J | last post by:
Kind of new at programming/vb.net. I'm doing this junky die roller program. Heres's what is supposed to happen: Roll 2 6-sided dies. Add rolls together put total in rolls(d6total). Display...
1
2557
by: amit | last post by:
Hi guys I am using access database with Crystal Reports in VS2003 I am working on "Hospital Database" The fields are - Name - Date - ConsultingCharge - TotalFees i.e. Total Fees include fees...
5
16223
abouddan
by: abouddan | last post by:
Hi all I am working on an accounting project using MS Access 2000, that demands to calculate many fields in a spesific record. The problem: The query I am using returns many records and for each...
42
2068
by: Doug | last post by:
I am in a friendly debate with some co-workers... and my boss. We use Access 2003 for the frontend (on workstations) as well as for the backend (on a Dell PowerEdge running Windows 2000 server,...
3
9023
by: Frank Rizzo | last post by:
I am trying to do some monitoring of some PerfMon counters and have a question. Does PerfMon figure out the Minimum, Maximum, Average values for each counter? Or are those values part of the...
0
4620
by: SuzK | last post by:
I am trying to calculate in VBA in Access 2002 a moving average and update a table with the calculations. Fields in my WeeklyData table are Week Ending (date) ItemNbr (double) Sales Dollars...
0
7124
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6998
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5460
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4586
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.