hi there..
i make simple system to make calculation in the end of each month bout point that car salesman from customer bout our their service
i make cmd button to calculate where criteria (by salesman name and month) based on combo box then the result (calculation) return to box..
i make 2 form:-
1. to edit record
2. to calculate
i've no problem in form 1 but in form 2 it say my calculation overflow and when debug. i c my calculation value = null
i let u c my coding and i attack my db to u guy.. plz help me.. i need help ASAP
note that i'm new with Access coding..
thanks...
i make simple system to make calculation in the end of each month bout point that car salesman from customer bout our their service
i make cmd button to calculate where criteria (by salesman name and month) based on combo box then the result (calculation) return to box..
i make 2 form:-
1. to edit record
2. to calculate
i've no problem in form 1 but in form 2 it say my calculation overflow and when debug. i c my calculation value = null
i let u c my coding and i attack my db to u guy.. plz help me.. i need help ASAP
Private Sub cmd_calculate_Click()
Dim rsSurvey As DAO.Recordset
Dim strSurvey As String
Dim Counter, Aaa1, Aaa2, Aaa3, Aaa4, Aaa5, Aaa6, Aaa7, Bbb1, Bbb2, Bbb3, Bbb4, Bbb5, Bbb6, Bbb7, Bbb8, Bbb9, Ccc1, Ccc2, Ccc3, Ccc4, Ccc5, Ccc6, Ccc7, Ccc8, Ccc9, Ddd1 As Integer
Set rsSurvey = CurrentDb.OpenRecordset("q_Survey")
''' strSurvey = Forms!f_Survey.RecordsetClone.RecordCount
strSurvey = rsSurvey.RecordCount
Me!TextTest = strSurvey ' try to see record(i mean row) count
' but it only show 1 instead of 4
' i think i make wrong code
Do While Not rsSurvey.EOF
If rsSurvey.Fields("SalesmanName") = Me.SalesmanName2 Then
If rsSurvey.Fields("MonthRegister") = Me.Month Then
If rsSurvey.Fields("YearRegister") = Me.Year Then
Aaa1 = rsSurvey.Fields("A1").Value + Aaa1
Aaa2 = rsSurvey.Fields("A2").Value + Aaa2
Aaa3 = rsSurvey.Fields("A3").Value + Aaa3
Aaa4 = rsSurvey.Fields("A4").Value + Aaa4
Aaa5 = rsSurvey.Fields("A5").Value + Aaa5
Aaa6 = rsSurvey.Fields("A6").Value + Aaa6
Aaa7 = rsSurvey.Fields("A7").Value + Aaa7
Bbb1 = rsSurvey.Fields("B1").Value + Bbb1
Bbb2 = rsSurvey.Fields("B2").Value + Bbb2
Bbb3 = rsSurvey.Fields("B3").Value + Bbb3
Bbb4 = rsSurvey.Fields("B4").Value + Bbb4
Bbb5 = rsSurvey.Fields("B5").Value + Bbb5
Bbb6 = rsSurvey.Fields("B6").Value + Bbb6
Bbb7 = rsSurvey.Fields("B7").Value + Bbb7
Bbb8 = rsSurvey.Fields("B8").Value + Bbb8
Bbb9 = rsSurvey.Fields("B9").Value + Bbb9
Ccc1 = rsSurvey.Fields("C1").Value + Ccc1
Ccc2 = rsSurvey.Fields("C2").Value + Ccc2
Ccc3 = rsSurvey.Fields("C3").Value + Ccc3
Ccc4 = rsSurvey.Fields("C4").Value + Ccc4
Ccc5 = rsSurvey.Fields("C5").Value + Ccc5
Ccc6 = rsSurvey.Fields("C6").Value + Ccc6
Ccc7 = rsSurvey.Fields("C7").Value + Ccc7
Ccc8 = rsSurvey.Fields("C8").Value + Ccc8
Ccc9 = rsSurvey.Fields("C9").Value + Ccc9
Ddd1 = rsSurvey.Fields("D1").Value + Ddd1
Counter = Counter + 1
rsSurvey.MoveNext
Else
rsSurvey.MoveNext
End If
Else
rsSurvey.MoveNext
End If
Else
rsSurvey.MoveNext
End If
Loop
Me.AA1 = Aaa1 / Counter
Me.AA2 = Aaa2 / Counter
Me.AA3 = Aaa3 / Counter
Me.AA4 = Aaa4 / Counter
Me.AA5 = Aaa5 / Counter
Me.AA6 = Aaa6 / Counter
Me.AA7 = Aaa7 / Counter
Me.BB1 = Bbb1 / Counter
Me.BB2 = Bbb2 / Counter
Me.BB3 = Bbb3 / Counter
Me.BB4 = Bbb4 / Counter
Me.BB5 = Bbb5 / Counter
Me.BB6 = Bbb6 / Counter
Me.BB7 = Bbb7 / Counter
Me.BB8 = Bbb8 / Counter
Me.BB9 = Bbb9 / Counter
Me.CC1 = Ccc1 / Counter
Me.CC2 = Ccc2 / Counter
Me.CC3 = Ccc3 / Counter
Me.CC4 = Ccc4 / Counter
Me.CC5 = Ccc5 / Counter
Me.CC6 = Ccc6 / Counter
Me.CC7 = Ccc7 / Counter
Me.CC8 = Ccc8 / Counter
Me.CC9 = Ccc9 / Counter
Me.DD1 = Ddd1 / Counter
End Sub
note that i'm new with Access coding..
thanks...