Anyone can help me perfect this function?

Anyone can help me perfect the Me.txt&Ibox&J = &I “v” &J

Dim I, J As Integer
      For I = 1 To 2
            For J = 1 To 5
       
                  Me.txt&Ibox&J = &I “v” &J

            Next J
      Next I

Example      :      Me.txt1box1 = 1v1
Example      :      Me.txt1box3 = 1v3
Example      :      Me.txt2box1 = 2v1
Example      :      Me.txt2box5 = 2v5

At the unbound box txt1box1, it will show 1v1 as output
Poop HolyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Poop HolyAuthor Commented:
Hmm... waiting 2 hrs before publish......
And
I've solve it before it is publish !!!!

Dim I, J As Integer
      For I = 1 To 2
            For J = 1 To 5
       
                  Me.Controls("txt" & I & "box" & J) = &I “v” &J

            Next J
      Next I

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Poop HolyAuthor Commented:
If anyone need this , here's my solution.
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Just as a side comment, two things:

1. You'll find your code easier to maintain in the future if you start giving your variables meaningful names.  ie.

Dim intRow as integer, intCol As Integer
      For intRow = 1 To 2
            For intCol= 1 To 5
        
                  Me("txt" & intRow & "box" & intCol) = intRow  & “v” & intCol

            Next intCol
      Next intRow 

Open in new window


  It also helps if you prefix the variable with the type (int = Integer, lng = Long, var = variant, etc).   There are several naming conventions out there.   It's not important which one you use, just that you use one and use it consistently.

2.  The other thing you should do is include comments that explain what your are doing.  Example:

  ' Set the text in the row and column controls
  ' to display ......

  You do not want to say what the code is doing, but rather why you are doing it.  For example, when deleting a file, this:

  ' Delete the file
  Kill strFile

   does not tell me much.   It is obvious from the Kill statement that I am deleting a file.   This is far better:

  ' Remove the temp work file before creating a new one.
  ' If we don't, this will cause an error
  Kill strFile

  Doing this will help you considerably in the future when you go to make changes in the code.

Jim.
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
You might want to take the time to view this:

https://www.experts-exchange.com/videos/536/MS-Access-Writing-Solid-VBA-Code.html

 It's short (less than 5 minutes).

Jim.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.