• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 457
  • Last Modified:

using "Insert Into" sql statement for access2000 using ado/vb6

I have a simple question?  Using the sql statement "Insert Into" for access 2000 mdb using ado in vb6 program, is the row (record) always inserted at the end of the table, i.e. after the last physical row in the table prior to the insertion?  

Morris
0
morrisbo
Asked:
morrisbo
  • 2
  • 2
1 Solution
 
leonstrykerCommented:
The simple answer is yes, but it depends on the Index. Why is this important?

Leon
0
 
morrisboAuthor Commented:
In a subsequent query I may want to either overwrite the last entry or add an additional record, depending on the contents of the previous last record added. (using ado's recordset.movelast).  This way I don't have to analyze every row.  I know I could index certain fields, then look directly for the previously entered record, but it seems simpler to just look for the last record.  

Actually, I am storing a "balance forward" type record from a commission statement.  If the commission statement is run more than once during the same month, I need to just update the last record, otherwise I need to "insert" a new record, indicating that I am dealing with a later month "brought forward" record from the previous month. Hope that makes sense.

It is a good question.  I am new at using sql and just want to keep it simple.

Thanks

Morris
0
 
leonstrykerCommented:
>Hope that makes sense

Yes, but no. You can not rely on the positioning to modify your data. There is nothing that will guaranty it.  Instead you need to use a unique identifier, most likely you primary key, to make sure you are dealing with the correct record.

Leon
0
 
morrisboAuthor Commented:
Leon,

Thanks,

I can do that.

Morris
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now