How do I DELETE the FIRST RECORD FROM A TABLE ?? I am using MS Access 2003
How do I DELETE the FIRST RECORD FROM A TABLE ?? I am using MS Access 2003
How do you define the first record in the table? Tables have no inherent order.
The TOp mose RECORD. Data is being added to the table by incoming SMS. The Primary Key is the Ser No which is an auto increment. I am extracting the TOP most SMS to put data into another table. ONE sms creates 4 records for the other table. After these 4 records are created, a query is generating the output in the desired format and the output is exported to excel. Thereafter a DELETE Query is DELETING ALL the DATA in the Tbl !(Where 4 records were created). I now want to DELETE the FIRST SMS, so that when I next pull out the TOP SMS, it is actually THE SECOND sms... and so on ................I worked out the entire process less the last step (DELETE FIRST RECORD)
Can you show us your table design?
You already know the PK number. Why don't you execute another delete query to delete the record where the PK field = the number of the current record that you are processing? Top record doesn't matter.The Primary Key is the Ser No which is an auto increment.
Something like:
(of course, you would have to use your table name and the variable name that has the autonumber or the record you are processing)Code:strSQL = "DELETE * FROM TableName WHERE [Ser No] = " & PK_RecordNumber Currentdb.Execute strSQL, dbfailonerror