none
Refer to report detail section textboxes in VBA RRS feed

  • Question

  • Using Access 2003 VBA, I have a report using some 57 bound and calculated fields.

    Client wants any field that is not equal to Zero to print in red.

    In the Detail On Print event of the report, I need to loop through the textbox controls of the the Detail Section.

    How do I refer to this report's Detail Section textboxes?

    Following code now changes all textboxes to red:

    Dim db As DAO.Database
    Dim ctl As Control
    Dim fld As DAO.Field
    Dim prp As Property???

    Set db = CurrentDb()

    For Each ctl In Me.Detail.Controls
        With ctl
            Select Case .ControlType   
            Case acTextBox
            '''Need to test for Zero value of each text box here??? If (txtboxv name) value > 0 then etc.
                .ForeColor = vbRed
            End Select
        End With
    Next
    • Moved by Reed KimbleMVP Tuesday, June 12, 2012 4:22 PM vba (From:Visual Basic Language)
    Tuesday, June 12, 2012 3:04 PM

All replies