Results 1 to 5 of 5
  1. #1
    anupludra is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2015
    Posts
    2

    Delete FIRST record from a table.


    How do I DELETE the FIRST RECORD FROM A TABLE ?? I am using MS Access 2003

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    How do you define the first record in the table? Tables have no inherent order.

  3. #3
    anupludra is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2015
    Posts
    2
    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)

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The Primary Key is the Ser No which is an auto increment.
    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.

    Something like:
    Code:
    strSQL = "DELETE * FROM TableName WHERE [Ser No] = " & PK_RecordNumber
    Currentdb.Execute strSQL, dbfailonerror
    (of course, you would have to use your table name and the variable name that has the autonumber or the record you are processing)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-10-2014, 05:58 AM
  2. Table shows deleted record but it won't delete
    By khughes46 in forum Access
    Replies: 3
    Last Post: 09-19-2014, 09:35 AM
  3. Delete record button from table using listbox
    By Ruegen in forum Programming
    Replies: 5
    Last Post: 09-08-2014, 09:02 PM
  4. Replies: 1
    Last Post: 10-22-2013, 06:48 AM
  5. delete table record with VBA
    By msasan1367 in forum Access
    Replies: 6
    Last Post: 07-07-2013, 11:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums