472,103 Members | 1,072 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,103 software developers and data experts.

Selecting single row from access table

40
Hello,

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.

Cheers!
Sep 10 '07 #1
3 8590
damonreid
114 Expert 100+
Search for "Update Query" in the help file, will give you everything you need.
Sep 10 '07 #2
saddist
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
barry07
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.

Similar topics

1 post views Thread by hristov.milen | last post: by
3 posts views Thread by Phil Rutter | last post: by
3 posts views Thread by equalive | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.