Edit Report Captions via For Loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mattloflin
    New Member
    • Jan 2008
    • 5

    #1

    Edit Report Captions via For Loop

    K guys... i'm stuck and i've been searching for about 6 hours and I hope it's an easy answer.

    This is what I have:
    [Code=vb]
    Private Sub Detail_Print(Ca ncel As Integer, PrintCount As Integer)
    Dim BegSerial As Integer
    Dim srl As String
    txtSerial1.Capt ion = Serial
    BegSerial = Serial
    If txtSerial1.Capt ion = Serial Then
    For x = 1 To 10
    srl = "txtSerial" & x
    MsgBox (srl)
    srl.Caption = BegSerial
    BegSerial = BegSerial + 1
    Next x
    End If
    End Sub
    [/Code]
    Serial is a global variable input by a form

    I have 10 labels on a report ex. txtSerial1 txtSerial2 etc. I need those to me incremented by 1 based off the first serial (BegSerial).
    I could do it the long way:
    if txtserial1.capt ion = serial then
    begserial = begseiral +1
    end if
    if txt... yadada

    there has to be an easier way HELP!!!!
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please use code tags.

    I refer you to this thread.

    Comment

    Working...