G
Guest
I am getting error messages stating that 'the object does not exist' when I
run the following code, used to compare a current record with the last one
for a consecutive increase in at least 2 fields of 15dB or more. I would be
grateful for some help please as I have tried revising this code many times
without success.
'This code for the ongoing comparison to baseline tests..
Dim dbs As Database, rst As Recordset
Dim strSelect As String
Dim L1 As Double, R1 As Double, L2 As Double, R2 As Double, L3 As Double, R3
As Double, L4 As Double, R4 As Double, L5 As Double, R5 As Double
Set dbs = CurrentDb
strSelect = "SELECT * FROM [Audio History]ORDER BY [Audio
History].DateCompleted DESC;"
Set rst = dbs.OpenRecordset(strSelect)
L1 = rst(CDbl([L1000]))
R1 = rst(CDbl([R1000]))
L2 = rst(CDbl([L2000]))
R2 = rst(CDbl([R2000]))
L3 = rst(CDbl([l3000]))
R3 = rst(CDbl([R3000]))
L4 = rst(CDbl([L4000]))
R4 = rst(CDbl([R4000]))
L5 = rst(CDbl([L6000]))
R5 = rst(CDbl([R6000]))
rst.MoveNext
If (L1 > rst([L1000] + 14) And (L2 > rst([L2000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (L2 > rst([L2000] + 14) And (L3 > rst([l3000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (L3 > rst([l3000] + 14) And (L4 > rst([L4000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (L4 > rst([L4000] + 14) And (L5 > rst([L5000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (R1 > rst([R1000] + 14) And (R2 > rst([R2000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (R2 > rst([R2000] + 14) And (R3 > rst([R3000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (R3 > rst([R3000] + 14) And (R4 > rst([R4000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (R4 > rst([R4000] + 14) And (R5 > rst([R5000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
Else: [ComparisonWithLast] = "No Change"
rst.Close
End If
End Sub
run the following code, used to compare a current record with the last one
for a consecutive increase in at least 2 fields of 15dB or more. I would be
grateful for some help please as I have tried revising this code many times
without success.
'This code for the ongoing comparison to baseline tests..
Dim dbs As Database, rst As Recordset
Dim strSelect As String
Dim L1 As Double, R1 As Double, L2 As Double, R2 As Double, L3 As Double, R3
As Double, L4 As Double, R4 As Double, L5 As Double, R5 As Double
Set dbs = CurrentDb
strSelect = "SELECT * FROM [Audio History]ORDER BY [Audio
History].DateCompleted DESC;"
Set rst = dbs.OpenRecordset(strSelect)
L1 = rst(CDbl([L1000]))
R1 = rst(CDbl([R1000]))
L2 = rst(CDbl([L2000]))
R2 = rst(CDbl([R2000]))
L3 = rst(CDbl([l3000]))
R3 = rst(CDbl([R3000]))
L4 = rst(CDbl([L4000]))
R4 = rst(CDbl([R4000]))
L5 = rst(CDbl([L6000]))
R5 = rst(CDbl([R6000]))
rst.MoveNext
If (L1 > rst([L1000] + 14) And (L2 > rst([L2000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (L2 > rst([L2000] + 14) And (L3 > rst([l3000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (L3 > rst([l3000] + 14) And (L4 > rst([L4000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (L4 > rst([L4000] + 14) And (L5 > rst([L5000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (R1 > rst([R1000] + 14) And (R2 > rst([R2000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (R2 > rst([R2000] + 14) And (R3 > rst([R3000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (R3 > rst([R3000] + 14) And (R4 > rst([R4000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
End If
If (R4 > rst([R4000] + 14) And (R5 > rst([R5000] + 14))) Then
[ComparisonWithLast] = "Abnormal Shift"
Else: [ComparisonWithLast] = "No Change"
rst.Close
End If
End Sub