By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,461 Members | 2,184 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,461 IT Pros & Developers. It's quick & easy.

Edit Report Captions via For Loop

P: 5
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:
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
  3. Dim BegSerial As Integer
  4. Dim srl As String
  5. txtSerial1.Caption = Serial
  6. BegSerial = Serial
  7. If txtSerial1.Caption = Serial Then
  8. For x = 1 To 10
  9. srl = "txtSerial" & x
  10. MsgBox (srl)
  11. srl.Caption = BegSerial
  12. BegSerial = BegSerial + 1
  13. Next x
  14. End If
  15. End Sub
  16.  
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.caption = serial then
begserial = begseiral +1
end if
if txt... yadada

there has to be an easier way HELP!!!!
Jan 9 '08 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,355
Please use code tags.

I refer you to this thread.
Jan 9 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.