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

Fill out a field list with a for ... next loop

P: 2
In a vb module I want to fill out the fields with a for ... next loop => see version2. But there is a problem. Can somebody knows the solution

Regards
Rolf


'====== Version1 ====
Expand|Select|Wrap|Line Numbers
  1. rs.Edit
  2.     rs![feld1] = "User1"
  3.     rs![feld2] = "User2"
  4.     rs![feld3] = "User3"
  5. rs.Update


'==== Version2 (with for .. next) don't work =====
Expand|Select|Wrap|Line Numbers
  1. rs.Edit
  2.     For i = 1 To 3
  3.         rs![feld & i] = "User" & i
  4.     Next
  5. rs.Update
Dec 15 '11 #1
Share this Question
Share on Google+
1 Reply


TheSmileyCoder
Expert Mod 100+
P: 2,321
You can reference fields by name like so:
Expand|Select|Wrap|Line Numbers
  1. rs.Edit
  2.     For i = 1 To 3
  3.         rs("feld" & i) = "User" & i
  4.     Next
  5. rs.Update
Dec 15 '11 #2

Post your reply

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