MkIIISupra
Programmer
I am doing a search for the high and low of a series of records, from there I will get the standard deviation and then compare a new read against that to see if it is within the realm of reasonable. If it isn't then I can research the problem and correct it before I update any tables. Here is the complete code string so it all makes sense:
Option Compare Database
Option Explicit
' Public Variables
Dim stDocName, stLinkCriteria, tblClr, strInput, strMsg, stHold _
, stHigh, stLow As String
Dim intCnt, intCnt2, intHigh, intLow As Integer
Private Sub Form_Load()
DoCmd.Maximize
stHigh = Me.USAGE ' Initialize USAGE to get the high low
stLow = Me.USAGE ' Initialize USAGE to get the high low
stHold = Me.ID_CODE
intCnt = 0
Do
If (Me.USAGE) > stHigh Then
stHigh = Me.USAGE
End If
' Here is where I am having problems! I have tried several iterations of this and all of them fail. I want the lowest number encountered to be trapped in the stLow field. But it's not happening. When I step through the code 385 is the lowest, the number right after that is 1149... now last time I checked 1149 in NOT less than 385... and yet, even though I have specified NOT to load stLow with USAGE... it still does! WHY?
If (Me.USAGE) < stLow Then
stLow = Me.USAGE
Else
stLow = stLow
End If
If (stHold) = (Me.ID_CODE) Then
intCnt = intCnt + 1
DoCmd.GoToRecord , , acNext
Else
Me.Text22.VALUE = Me.Text22 & vbCrLf & "ID_CODE = " & stHold & " Records = " _
& intCnt & " HIGH USAGE = " & stHigh & " LOW USAGE = " & stLow
stHold = Me.ID_CODE
stHigh = Me.USAGE
stLow = Me.USAGE
intCnt = 0
End If
Loop Until IsNull(Me.ID_CODE)
Me.Text22.VALUE = Me.Text22 & vbCrLf & "ID_CODE = " & stHold & " Records = " _
& intCnt & " HIGH USAGE = " & stHigh & " LOW USAGE = " & stLow
End Sub
Again, I do not understand why the > works just fine and gives me the Max value and skips like it is supposed to and yet the < doesn't work at all!
One by one the penguins return my sanity, as day by day Microsoft steals my sanity!
OpenSuSE 10.0 kicks fanny!
Option Compare Database
Option Explicit
' Public Variables
Dim stDocName, stLinkCriteria, tblClr, strInput, strMsg, stHold _
, stHigh, stLow As String
Dim intCnt, intCnt2, intHigh, intLow As Integer
Private Sub Form_Load()
DoCmd.Maximize
stHigh = Me.USAGE ' Initialize USAGE to get the high low
stLow = Me.USAGE ' Initialize USAGE to get the high low
stHold = Me.ID_CODE
intCnt = 0
Do
If (Me.USAGE) > stHigh Then
stHigh = Me.USAGE
End If
' Here is where I am having problems! I have tried several iterations of this and all of them fail. I want the lowest number encountered to be trapped in the stLow field. But it's not happening. When I step through the code 385 is the lowest, the number right after that is 1149... now last time I checked 1149 in NOT less than 385... and yet, even though I have specified NOT to load stLow with USAGE... it still does! WHY?
If (Me.USAGE) < stLow Then
stLow = Me.USAGE
Else
stLow = stLow
End If
If (stHold) = (Me.ID_CODE) Then
intCnt = intCnt + 1
DoCmd.GoToRecord , , acNext
Else
Me.Text22.VALUE = Me.Text22 & vbCrLf & "ID_CODE = " & stHold & " Records = " _
& intCnt & " HIGH USAGE = " & stHigh & " LOW USAGE = " & stLow
stHold = Me.ID_CODE
stHigh = Me.USAGE
stLow = Me.USAGE
intCnt = 0
End If
Loop Until IsNull(Me.ID_CODE)
Me.Text22.VALUE = Me.Text22 & vbCrLf & "ID_CODE = " & stHold & " Records = " _
& intCnt & " HIGH USAGE = " & stHigh & " LOW USAGE = " & stLow
End Sub
Again, I do not understand why the > works just fine and gives me the Max value and skips like it is supposed to and yet the < doesn't work at all!
One by one the penguins return my sanity, as day by day Microsoft steals my sanity!
OpenSuSE 10.0 kicks fanny!