Selecting single row from access table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saddist
    New Member
    • Jul 2007
    • 40

    Selecting single row from access table

    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!
  • damonreid
    Recognized Expert New Member
    • Jul 2007
    • 114

    #2
    Search for "Update Query" in the help file, will give you everything you need.

    Comment

    • saddist
      New Member
      • Jul 2007
      • 40

      #3
      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.

      Comment

      • barry07
        New Member
        • Jan 2007
        • 47

        #4
        Use the ADO recordset. The syntax is something like this

        Code:
        Function CycleThroughRecords
        Dim dbs as Database
        Dim rs as Recordset
        set dbs=CurrentDB
        set rs=dbs.openRecordset("SELECT  whatever from [table] where...")
        rs.movefirst
        while not rs.EOF
               .<manipulte records>
                rs.movenext
        wend
        set rs=nothing
        set dbs=nothing
        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

        Comment

        Working...