Perhaps I have not explained very well....
TABLE Employees
RecNum INTEGER PK
First STRING
Last STRING
I gain access to the table via the Cursor object by executing a SELECT clause....
Cursor = SQL1.ExecQuery("SELECT * FROM Employees ORDER BY Last, First")
Then I add a row using the INSERT clause:
SQL1.ExecNonQuery2("INSERT INTO Employees ('First','Last') VALUES (?, ?)", Array As Object("Joseph", "Bloggs"))
The row is added to the underlying database BUT the new row is not visible programmaticly until you execute another SELECT clause.....
Cursor = SQL1.ExecQuery("SELECT * FROM Employees........ORDER...
At this point you have lost any reference to the row that was just added as any ORDER clause has placed the row somewhere in the middle of the recordset.
I want to come out of the INSERT + SELECT process with a pointer to the last added row so that I can immediately make that row the current Cursor position in the ORDERed recordset. Something like a method to set the Cursor.Position at the highest [RecNum] ?????
At the moment I add a row then reposition using this code but it is not very elegant or efficient...
SQL1.ExecNonQuery2("INSERT INTO Employees ('First','Last') VALUES (?, ?)", Array As Object("Joseph", "Bloggs"))
Cursor = SQL1.ExecQuery("SELECT * FROM Employees ORDER by Last, First")
Dim count as Int
For count = 0 To Cursor.RowCount - 1
Cursor.Position= count
If LastAddedSurname = Cursor.GetString("Last") Then Exit
Next
PopulateViewFieldsWithLastAddedRow '(!)
Maybe a wishlist ????
Cursor.MoveFirst
Cursor.MoveLast
Cursor.MoveNext
Cursor.MovePrevious
Cursor.MoveLastAdded