Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Split record into several programatically (A97)

    I have a table with records that contain a Begin and End field. These fields indicate a range of Travelers Check numbers, such as Begin: 125 End 130. There are many records with different ranges such as this. I would like create a new record for each Travelers Check in the range, and append the records to another table. For instance, a separate record for 125, 126, 127, 128, 129 and 130. Can anyone give me an idea of the syntax in VB required to accomplish this?

    Thanks,

    Julia

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Split record into several programatically (A97)

    On the fly without testing.
    <pre>Sub AddTravellerCheck()
    Dim db As Database
    Dim rstTable As Recordset
    Dim rstOtherTable As Recordset
    Dim i As Integer
    Set db = CurrentDb
    Set rstTable = db.OpenRecordset("TableWithNumber", dbOpenDynaset)
    Set rstOtherTable = db.OpenRecordset("OtherTable", dbOpenDynaset)
    Do While Not rstTable.EOF
    With rstOtherTable
    For i = rstTable!Begin To rstTable!End
    .AddNew
    !checknumber = i
    .Update
    Next i
    End With
    rstTable.MoveNext
    Loop
    Set rstTable = Nothing
    Set rstOtherTable = Nothing
    Set db = Nothing
    End Sub
    </pre>

    Francois

  3. #3
    New Lounger
    Join Date
    Mar 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Split record into several programatically (A97)

    Thanks!!

    I tried it out and it works....I appreciate your help!

    -Julia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •