Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Appending one row at a time

Discussion in 'Information Technology' started by BK, Jul 28, 2006.

  1. BK

    BK
    Expand Collapse
    Guest

    I have a VBA that runs a query and appends the part numbers from one table to
    another table. The VBA contains a loop that executes while not end of table.
    I want to be able to append one row from the parts table at a time. Is this
    possible?
     
  2. Loading...

    Similar Threads Forum Date
    Sorrow Makes You Realize The Unreality Of This World And All Its Relations Hard Talk Nov 20, 2016
    Sikh News Sikh Farmers Flatten Ravines To Grow Basmati - Times Of India Breaking News Jul 27, 2016
    Sikh News Profiled US Sikh Throws 'Know Me' Challenge Breaking News Jul 25, 2016
    Pacific Storms Hit Banana-growing Sikh Community Hard Breaking News Jun 9, 2016
    Sikhism Religion And Economic Growth: Elements From Sikhism Book Reviews & Editorials Apr 19, 2016

  3. Sharkbyte

    Sharkbyte
    Expand Collapse
    Guest

    Is it that you would like to interact, with the db, between each update? If
    so, the simple solution would seem to be to remove the loop.

    Sharkbyte



    "BK" wrote:

    > I have a VBA that runs a query and appends the part numbers from one table to
    > another table. The VBA contains a loop that executes while not end of table.
    > I want to be able to append one row from the parts table at a time. Is this
    > possible?
     
  4. BK

    BK
    Expand Collapse
    Guest

    There are nine items in the part number table. When I run the VBA with the
    loop, those nine items are appended nine times, for a total of 81 items in
    the new table. Without the loop the nine items are all appended, but I want
    to be able to just append one of the rows at a time, if this is possible?
    BK

    "Sharkbyte" wrote:

    > Is it that you would like to interact, with the db, between each update? If
    > so, the simple solution would seem to be to remove the loop.
    >
    > Sharkbyte
    >
    >
    >
    > "BK" wrote:
    >
    > > I have a VBA that runs a query and appends the part numbers from one table to
    > > another table. The VBA contains a loop that executes while not end of table.
    > > I want to be able to append one row from the parts table at a time. Is this
    > > possible?
     
  5. Sharkbyte

    Sharkbyte
    Expand Collapse
    Guest

    There is something wrong in your loop. You are not distinctly identifying
    each row, and so it runs the append for all 9 records. Then, when it moves
    to the next record, and cannot uniquely identify each record, it appends all
    9 again; etc, until the loop completes.

    You need to add a unique identifier, for each record, to the loop criteria.
    This way the loop only process one record on each pass.

    Sharkbyte




    "BK" wrote:

    > There are nine items in the part number table. When I run the VBA with the
    > loop, those nine items are appended nine times, for a total of 81 items in
    > the new table. Without the loop the nine items are all appended, but I want
    > to be able to just append one of the rows at a time, if this is possible?
    > BK
    >
    > "Sharkbyte" wrote:
    >
    > > Is it that you would like to interact, with the db, between each update? If
    > > so, the simple solution would seem to be to remove the loop.
    > >
    > > Sharkbyte
    > >
    > >
    > >
    > > "BK" wrote:
    > >
    > > > I have a VBA that runs a query and appends the part numbers from one table to
    > > > another table. The VBA contains a loop that executes while not end of table.
    > > > I want to be able to append one row from the parts table at a time. Is this
    > > > possible?
     
  6. BK

    BK
    Expand Collapse
    Guest

    Thanks for the advice, I've been making progress but it still isn't
    completely working, do you happen to have any specific examples of what to
    add to the loop?

    "Sharkbyte" wrote:

    > There is something wrong in your loop. You are not distinctly identifying
    > each row, and so it runs the append for all 9 records. Then, when it moves
    > to the next record, and cannot uniquely identify each record, it appends all
    > 9 again; etc, until the loop completes.
    >
    > You need to add a unique identifier, for each record, to the loop criteria.
    > This way the loop only process one record on each pass.
    >
    > Sharkbyte
    >
    >
    >
    >
    > "BK" wrote:
    >
    > > There are nine items in the part number table. When I run the VBA with the
    > > loop, those nine items are appended nine times, for a total of 81 items in
    > > the new table. Without the loop the nine items are all appended, but I want
    > > to be able to just append one of the rows at a time, if this is possible?
    > > BK
    > >
    > > "Sharkbyte" wrote:
    > >
    > > > Is it that you would like to interact, with the db, between each update? If
    > > > so, the simple solution would seem to be to remove the loop.
    > > >
    > > > Sharkbyte
    > > >
    > > >
    > > >
    > > > "BK" wrote:
    > > >
    > > > > I have a VBA that runs a query and appends the part numbers from one table to
    > > > > another table. The VBA contains a loop that executes while not end of table.
    > > > > I want to be able to append one row from the parts table at a time. Is this
    > > > > possible?
     
  7. BK

    BK
    Expand Collapse
    Guest

    Public Function vAppendPartNumbers()
    Dim rstTestParts As Recordset
    Set rstTestParts = CurrentDb().OpenRecordset("TestParts")
    g_strPartNumber = rstTestParts![PartNumber]
    DoCmd.OpenQuery ("TestQueryDelete")
    While Not rstTestParts.EOF
    DoCmd.OpenQuery ("TestQuery2")

    rstTestParts.MoveNext

    Wend

    here is the loop, could the problem be with the query?

    "BK" wrote:

    > Thanks for the advice, I've been making progress but it still isn't
    > completely working, do you happen to have any specific examples of what to
    > add to the loop?
    >
    > "Sharkbyte" wrote:
    >
    > > There is something wrong in your loop. You are not distinctly identifying
    > > each row, and so it runs the append for all 9 records. Then, when it moves
    > > to the next record, and cannot uniquely identify each record, it appends all
    > > 9 again; etc, until the loop completes.
    > >
    > > You need to add a unique identifier, for each record, to the loop criteria.
    > > This way the loop only process one record on each pass.
    > >
    > > Sharkbyte
    > >
    > >
    > >
    > >
    > > "BK" wrote:
    > >
    > > > There are nine items in the part number table. When I run the VBA with the
    > > > loop, those nine items are appended nine times, for a total of 81 items in
    > > > the new table. Without the loop the nine items are all appended, but I want
    > > > to be able to just append one of the rows at a time, if this is possible?
    > > > BK
    > > >
    > > > "Sharkbyte" wrote:
    > > >
    > > > > Is it that you would like to interact, with the db, between each update? If
    > > > > so, the simple solution would seem to be to remove the loop.
    > > > >
    > > > > Sharkbyte
    > > > >
    > > > >
    > > > >
    > > > > "BK" wrote:
    > > > >
    > > > > > I have a VBA that runs a query and appends the part numbers from one table to
    > > > > > another table. The VBA contains a loop that executes while not end of table.
    > > > > > I want to be able to append one row from the parts table at a time. Is this
    > > > > > possible?
     

Share This Page