Results 1 to 5 of 5
  1. #1
    clacaz is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    5

    How to refer to numbered text boxes within VBA

    I have created a form with several text boxes (Text1, Text2, Text3, ..., Text60).



    I want to populate each of them with a specific value.

    In order to do so, I want to create a For Next loop to avoid having to create one code line for each text box. Something on following lines:

    For i= 1 to 60
    Texti.value = "A"
    Next i

    Could someone tell me how to do that?

    Regards,

    Cássio

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,827
    Try

    Me("Text" & i) = "A"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    clacaz is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    5
    It worked great!

    Thank you.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,827
    No problem, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    clacaz is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    5
    Thank you. And I hope I can also contribute to the site.

    Regards,

    Cássio

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 06-04-2014, 10:45 AM
  2. Replies: 15
    Last Post: 04-01-2011, 11:41 AM
  3. Replies: 4
    Last Post: 02-14-2011, 09:11 AM
  4. Replies: 15
    Last Post: 09-18-2010, 01:19 PM
  5. A column numbered: 1,2,3,4,5...
    By eezing in forum Queries
    Replies: 1
    Last Post: 08-18-2009, 09:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums