Results 1 to 5 of 5

Thread: Insert record

  1. #1
    Join Date
    Sep 2005
    Posts
    28

    Unanswered: Insert record

    Hi :

    In VB Code,
    I know this one,

    rs.AddNew
    rs.Fields("Unit") = rstemp.Fields("Unit").value
    ..

    rs.update

    But, this one is only insert the record at the end each time, what command can insert in the middle

    For example:

    Table1:
    Unit Amount
    1____$23
    2____$7
    3____$88

    I want to insert one record:Unit is 2, Amount is $3
    And put it in the 2nd row

    Table1:
    Unit Amount
    1____$23
    2____$3
    2____$7
    3____$88

    What command I need to use? Thanks.

  2. #2
    Join Date
    Nov 2002
    Posts
    272
    Quote Originally Posted by accessman3
    I want to insert one record:Unit is 2, Amount is $3
    And put it in the 2nd row
    You can't, and you shouldn't want to. You can't tell Access where to store its data, and you don't need to; Access knows how to do that.

    When you select your data, you can order it any way you want.

  3. #3
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    What is a PRIMARY KEY in your table.

  4. #4
    Join Date
    Sep 2005
    Posts
    313
    There is NO Primary key in the table.

    I just want to add a record in there.

    I just want to know how to insert it, then move the others record down one row when insert one record.

    Thanks.

  5. #5
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by accessman2
    There is NO Primary key in the table.

    I just want to add a record in there.

    I just want to know how to insert it, then move the others record down one row when insert one record.

    Thanks.
    Access IS NOT a flat file database ... You just add the record and have your query (or queries) report the info in the order you specify ... Access writes records internally sequentially. It doesn't reorder them except upon a compact & repair when the database is re-optimized. If you notice, when opening a table, Access runs an internal query to display the records for you ...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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