I have made a validation routine to check through my data to see the values within my table are correct using the code below.
I know theres errors in my table yet no errors are found.
I know its something to do with my referencing of these table fields :RS![C/F] & [BalanceC/F] as when I step through the code no values are shown when I hover over the references, they just show up as "0" yet the other references show values.
Private Sub Command62_Click()
Dim lp As Integer
Dim RS As DAO.Recordset
Dim Cal1 As Double
Dim Cal2 As Double
Dim Cal3 As Double
Dim Cal4 As Double
Set RS = Me.RecordsetClone
RS.MoveFirst
Cal1 = RS![C/F] + RS!EELoan - RS!Profit
Cal2 = [BalanceC/F]
Cal3 = RS!NetProfit - RS!Tax
Cal4 = RS!Profit
For lp = 1 To RS.RecordCount
If Cal1 <> Cal2 Then
MsgBox ("Error 1" & " " & RS![C/F] + RS!EELoan - RS!Profit & " " & "record" & " " & lp & " " & RS![BalanceC/F])
ElseIf Cal3 <> Cal4 Then
MsgBox ("Error 2" & " " & RS!NetProfit - RS!Tax & " " & "record" & " " & lp & " " & RS!Profit)
End If
RS.MoveNext
Next lp
End Sub
I've tried forever to fix this, searched the forum but can't find nothing please help! Cheers Pete ; )
I know theres errors in my table yet no errors are found.
I know its something to do with my referencing of these table fields :RS![C/F] & [BalanceC/F] as when I step through the code no values are shown when I hover over the references, they just show up as "0" yet the other references show values.
Private Sub Command62_Click()
Dim lp As Integer
Dim RS As DAO.Recordset
Dim Cal1 As Double
Dim Cal2 As Double
Dim Cal3 As Double
Dim Cal4 As Double
Set RS = Me.RecordsetClone
RS.MoveFirst
Cal1 = RS![C/F] + RS!EELoan - RS!Profit
Cal2 = [BalanceC/F]
Cal3 = RS!NetProfit - RS!Tax
Cal4 = RS!Profit
For lp = 1 To RS.RecordCount
If Cal1 <> Cal2 Then
MsgBox ("Error 1" & " " & RS![C/F] + RS!EELoan - RS!Profit & " " & "record" & " " & lp & " " & RS![BalanceC/F])
ElseIf Cal3 <> Cal4 Then
MsgBox ("Error 2" & " " & RS!NetProfit - RS!Tax & " " & "record" & " " & lp & " " & RS!Profit)
End If
RS.MoveNext
Next lp
End Sub
I've tried forever to fix this, searched the forum but can't find nothing please help! Cheers Pete ; )