Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Make table from last record (Access 2000)

    I want to make a table containing only the last record of the old table.For example i have a table orders.I want to make a new table orders1 where only the last record exists with all the fields available.Is it possible ? The autonumber of the table is called orderid

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Make table from last record (Access 2000)

    Hi there

    I may have looked at this too simply but could you not just copy and paste the table and rename it with structure only and then copy the last record of the original into it?

    Or are you looking for a VB coded solution?
    Jerry

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Make table from last record (Access 2000)

    Now I have had my supper <img src=/S/yum.gif border=0 alt=yum width=15 height=15> and thought about it more, you can use the Max inTotal view of the query and then create a make table query from it. Thi scan then be run from a macro.
    Jerry

  4. #4
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Make table from last record (Access 2000)

    Thank you for your reply.I need to have it with VB.I tried but somehow my code does not work.Would you have a look ?

    Dim db As Database
    Set db = CurrentDb
    CurrentDb.Execute ("INSERT INTO [buffer] WHERE orderid = (select max(orderid) from [order details]")

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Make table from last record (Access 2000)

    You don't specify what you want to select and from which table.

    Create a query in design view that appends the records you want. Check that it works correctly. Then look at the SQL of this query (View | SQL).

Posting Permissions

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