Hello,
I have code that is doing what I want it to do on my Report except when it comes across the occasional >,< signs.{For "Ammonia", when there is a number less than 1, put "BDL", for all other digits round to one decimal place(that's fine!)}. {For "CBOD", when there is a number less than 1, put "BDL", for all other digits round to a whole number (that's fine except when I have to include a > or < sign with the digit)} Then, I get this error: Run-time error '13': Type mismatch. Debugging shows it is getting hung-up at the Rounding part of the code. Again,(Me.ACOM) is a field the holds results for chemical test so it will be an integer, except when we have to include the <, > sign.
My question is this:
What can I add to my code that would allow it to tolerate the >,< the signs without giving me the error message? Here is my code:
Private Sub Detail1_Print(Cancel As Integer, PrintCount As Integer)
FIND_ACOM
End Sub
Private Sub FIND_ACOM()
If CStr(Me.ACOM) <> "PENDING" Then
Select Case Me.ANAL
Case "Ammonia (NH3-N)"
If Me.ACOM < 0.2 Then
Me.Text67 = "BDL"
Else
Me.Text67 = Format(Round(Me.ACOM, 1), "0.0")
End If
Case "CBOD"
If Me.ACOM < 1# Then
Me.Text67 = "BDL"
Else
Me.Text67 = Format(Round(Me.ACOM, 0), "0")
End Select
Else
Me.ACOM1 = Me.ACOM
End If
End Sub
I have code that is doing what I want it to do on my Report except when it comes across the occasional >,< signs.{For "Ammonia", when there is a number less than 1, put "BDL", for all other digits round to one decimal place(that's fine!)}. {For "CBOD", when there is a number less than 1, put "BDL", for all other digits round to a whole number (that's fine except when I have to include a > or < sign with the digit)} Then, I get this error: Run-time error '13': Type mismatch. Debugging shows it is getting hung-up at the Rounding part of the code. Again,(Me.ACOM) is a field the holds results for chemical test so it will be an integer, except when we have to include the <, > sign.
My question is this:
What can I add to my code that would allow it to tolerate the >,< the signs without giving me the error message? Here is my code:
Private Sub Detail1_Print(Cancel As Integer, PrintCount As Integer)
FIND_ACOM
End Sub
Private Sub FIND_ACOM()
If CStr(Me.ACOM) <> "PENDING" Then
Select Case Me.ANAL
Case "Ammonia (NH3-N)"
If Me.ACOM < 0.2 Then
Me.Text67 = "BDL"
Else
Me.Text67 = Format(Round(Me.ACOM, 1), "0.0")
End If
Case "CBOD"
If Me.ACOM < 1# Then
Me.Text67 = "BDL"
Else
Me.Text67 = Format(Round(Me.ACOM, 0), "0")
End Select
Else
Me.ACOM1 = Me.ACOM
End If
End Sub