Results 1 to 2 of 2

Thread: exporting and deleting records from access2k

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Posts
    88

    Post

    i'll start with a little background. i import a text into a table in access 2000. after creating a couple of pieces of paper i copy some of the fields into another table and then export from the second table. during the process that exports i want to delete all of the records from both tables. when i run the program, everyother record gets exported and deleted. those records that aren't exported are still in my tables. i am using ADO and the texttransfer function within access 2000. does anyone have any suggestions?

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Posts
    88

    Post

    Here is my code if it will be of any help...

    Public Sub MapToExp()

    Dim ShipSql As String
    Dim BookSql As String
    Dim ExpBookSql As String
    Dim ExpShipSql As String

    ShipSql = "Select * From Shipping"
    BookSql = "Select * From Books"
    ExpBookSql = "Select * From ExpBooks"
    ExpShipSql = "Select * From ExpShipping"

    Ship.Open ShipSql, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
    ExpShip.Open ExpShipSql, CurrentProject.Connection, adOpenDynamic, adLockOptimistic

    Do Until Ship.EOF = True
    ExpShip.AddNew
    ExpShip.Fields(0) = Ship.Fields(0)
    ExpShip.Fields(1) = Ship.Fields(1)
    ExpShip.Fields(2) = Ship.Fields(2)
    ExpShip.Fields(3) = Ship.Fields(3)
    ExpShip.Fields(4) = Ship.Fields(4)
    ExpShip.Fields(5) = Ship.Fields(5)
    ExpShip.Fields(6) = Ship.Fields(6)
    ExpShip.Fields(7) = Ship.Fields(7)
    ExpShip.Fields(8) = Ship.Fields(8)
    ExpShip.Fields(9) = Ship.Fields(9)
    ExpShip.Fields(10) = Ship.Fields(10)
    ExpShip.Fields(11) = Ship.Fields(11)
    ExpShip.Fields(12) = Ship.Fields(12)
    ExpShip.Fields(13) = Ship.Fields(13)
    ExpShip.Fields(14) = Ship.Fields(22)
    ExpShip.Update
    Ship.delete
    Ship.MoveNext
    Loop

    Book.Open BookSql, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
    ExpBook.Open ExpBookSql, CurrentProject.Connection, adOpenDynamic, adLockOptimistic

    Do Until Book.EOF = True
    ExpBook.AddNew
    ExpBook.Fields(0) = Book.Fields(0)
    ExpBook.Fields(1) = Book.Fields(1)
    ExpBook.Fields(2) = Book.Fields(2)
    ExpBook.Fields(3) = Book.Fields(5)
    ExpBook.Update
    Book.delete
    Book.MoveNext
    Loop
    End Sub

Posting Permissions

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



Click Here to Expand Forum to Full Width