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

Selecting single row from access table

P: 40

I have an access table with fields: ID, Name, Surname, Training. I would like to select every single row in this table to operate on it. Alghoritm would look something like that:
i = 1 to all_rows
1. Select i row
2. Check if ID exists in EMPLOYEES table
3. Read ID, Name and Surname and insert it in table EMPLOYEES
4. Read ID and Training and insert it in table PAST_TRAINIGS
5. Return to 1

How can I do that in Visual Basic code? The problem is in selecting every each row and columns in this row.

Sep 10 '07 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 114
Search for "Update Query" in the help file, will give you everything you need.
Sep 10 '07 #2

P: 40
You are missing the point here. I don't want to have an update query. I wrote I want it to be done via VBA code and I have my reasons. Plus I want it done just as in algorithm I wrote in first post.
Sep 10 '07 #3

P: 47
Use the ADO recordset. The syntax is something like this

Expand|Select|Wrap|Line Numbers
  1. Function CycleThroughRecords
  2. Dim dbs as Database
  3. Dim rs as Recordset
  4. set dbs=CurrentDB
  5. set rs=dbs.openRecordset("SELECT  whatever from [table] where...")
  6. rs.movefirst
  7. while not rs.EOF
  8.        .<manipulte records>
  9.         rs.movenext
  10. wend
  11. set rs=nothing
  12. set dbs=nothing
  13. End Function
This should be enough to get you started. The RecordSet object allows very granular access to the data, but yiu can read about that yourself
Sep 10 '07 #4

Post your reply

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