Record needs to reference last record

Dugantrain

I Love Pants
Local time
Today, 15:35
Joined
Mar 28, 2002
Messages
221
I'd like to know the code which will have one of the text boxes on a report look back at the same text box in the record right before it. If the value of the former textbox doesn't match with this text box's value, then this textbox's forecolor will be vbRed. I also need to be able to turn this back off so that the forecolor of all of the text boxes will be vbBlack until this flag goes up once again.
 
dugantrain:

In the report's code window:
Private LastTextBox As String

In the Report's OnOpen event:
LastTextBox = ""

In the DetailPrint event:
Code:
If LastTextBox <> Me.TextBox Then
   LastTextBox = Me.TextBox
   Me.TextBox.ForeColor = vbRed
Else
  Me.TextBox.ForeColor = vbBlack
End If

Wayne
 
OK, that works fine, but I actually now need something a little more complex: I need Txt1 to reference the previous record, but a different textbox in that record (let's say Txt2). If they don't match up, then Txt1 is vbRed, if they do, then vbBlack (txt1 and txt2 in the same record need not necessarily match up).
 
Last edited:
dugantrain:

In the report's code window:
Private LastTextBox As String

In the Report's OnOpen event:
LastTextBox = ""

In the DetailPrint event:

Code:
If LastTextBox <> Me.Txt1 Then
   LastTextBox = Me.Txt2
   Me.Txt1.ForeColor = vbRed
Else
  Me.Txt1.ForeColor = vbBlack
End If


Wayne
 

Users who are viewing this thread

Back
Top Bottom