The following code marks claim numbers in a report if they are duplicates of the previous claim number printed or if there is a gap in sequence between the current and previous claim numbers. Michael Red got me to the point that this works, except that when the list goes on to a new column or page, the Retreat event causes the code to run again, which means the first record of every new column is marked as a duplicate.
I had intended to learn some VBA skills and figure out how to fix this myself, but illness has kept me from studying. Now I find that this job is ending Friday, and I would like to have the report running smoothly before I go. Can anyone help? Thanks.
Option Compare Database
Option Explicit
Private Type CodeStatusType
Branch As String
CodeRt As String
End Type
Dim CodeStatus As CodeStatusType
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim StatusFlag As String
Dim blnNoCalc As Boolean
StatusFlag = ""
'Check for First Pass
If (CodeStatus.Branch = "" And CodeStatus.CodeRt = "" Then
'Initalization
With CodeStatus
.Branch = [Branch]
.CodeRt = [CodeRt]
End With
blnNoCalc = True
End If
'Not First Pass, Check for Branch Change
If (CodeStatus.Branch <> [Branch]) Then
'OOps - Change of Branch, So Dup and Seq == False
With CodeStatus
.Branch = [Branch]
.CodeRt = [CodeRt]
End With
blnNoCalc = True
End If
If (Not blnNoCalc) Then
'Check For DUPLICATE
If (CodeStatus.CodeRt = [CodeRt]) Then
StatusFlag = "+"
blnNoCalc = True
End If
End If
If (Not blnNoCalc) Then
If (CLng(CodeStatus.CodeRt) + 1 <> [CodeRt]) Then
StatusFlag = "*"
End If
End If
Me.txtStatus = StatusFlag
With CodeStatus
.Branch = [Branch]
.CodeRt = [CodeRt]
End With
End Sub
Let me know if further detail is needed.
I had intended to learn some VBA skills and figure out how to fix this myself, but illness has kept me from studying. Now I find that this job is ending Friday, and I would like to have the report running smoothly before I go. Can anyone help? Thanks.
Option Compare Database
Option Explicit
Private Type CodeStatusType
Branch As String
CodeRt As String
End Type
Dim CodeStatus As CodeStatusType
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim StatusFlag As String
Dim blnNoCalc As Boolean
StatusFlag = ""
'Check for First Pass
If (CodeStatus.Branch = "" And CodeStatus.CodeRt = "" Then
'Initalization
With CodeStatus
.Branch = [Branch]
.CodeRt = [CodeRt]
End With
blnNoCalc = True
End If
'Not First Pass, Check for Branch Change
If (CodeStatus.Branch <> [Branch]) Then
'OOps - Change of Branch, So Dup and Seq == False
With CodeStatus
.Branch = [Branch]
.CodeRt = [CodeRt]
End With
blnNoCalc = True
End If
If (Not blnNoCalc) Then
'Check For DUPLICATE
If (CodeStatus.CodeRt = [CodeRt]) Then
StatusFlag = "+"
blnNoCalc = True
End If
End If
If (Not blnNoCalc) Then
If (CLng(CodeStatus.CodeRt) + 1 <> [CodeRt]) Then
StatusFlag = "*"
End If
End If
Me.txtStatus = StatusFlag
With CodeStatus
.Branch = [Branch]
.CodeRt = [CodeRt]
End With
End Sub
Let me know if further detail is needed.