Smart questions
Smart people
 Find A ForumFind An Expert
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Remember Me

Are you a
Computer / IT professional?
Join Tek-Tips now!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

#### Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site

#### Feedback

"...I signed up to your site to get help with a problem and I am so glad I did. I found the help I needed immediately. Thanks to all who contribute to your site..."

#### Geography

Where in the world do Tek-Tips members come from?

# Populate fields in excel from access form

 Forum Search FAQs Links Jobs Whitepapers MVPs
 access101 (Programmer) 27 May 12 11:10
 i have a form with 60 textboxes named I1- I60i need a for statement that will loop through and populate my excel spreadsheetfor this example I1=54.25I2=38.16so far i have this which works but is not looping correctlyFor a = 7 To 8For b = 1 To 2xlSheet.Range("d" & a) = Me("I" & b)Next b, aonce i run the codeexcel showsd7 = 38.16d8 = 38.16
 dhookom (Programmer) 28 May 12 15:56
 Your code is expecting to find a bound control name "I1" and "I2". You might want to use arrays or possibly the Eval() function.
 access101 (Programmer) 28 May 12 16:49
 can you please show me an example
 dhookom (Programmer) 28 May 12 22:17
It would help to understand you requirements better. However consider code like:

#### CODE --> vba

Public Function TestArray() Dim arI(2) Dim b As Integer arI(1) = 54.25 arI(2) = 38.16 For b = 1 To 2 Debug.Print arI(b) Next End Function
 TheAceMan1 (Programmer) 29 May 12 7:57
access101 . . .

Just a guess ...

#### CODE

Dim a As Long, b As Long For a = 7 To 8 b = a - 6 xlSheet.Range("d" & a) = Me("I" & b) Next

See Ya! . . . . . .

Be sure to see FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions? Worthy Reading!
Also FAQ181-2886: How can I maximize my chances of getting an answer? Worthy Reading!

 access101 (Programmer) 29 May 12 22:28
 thanks TheAceMan1 that worked! I still don't understand why your code worked vs mine but appreciate the help.
 TheAceMan1 (Programmer) 30 May 12 7:08
 access101 . . .Hint! ... you only need one loop! See Ya! . . . . . .Be sure to see FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions? Worthy Reading! Also FAQ181-2886: How can I maximize my chances of getting an answer? Worthy Reading!

#### Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!