ADO - Delete single row

Jan Erik

Board Regular
Joined
May 24, 2005
Messages
78
Hi,

I want to delete a single row in an Access database using the ROWNUMBER. I think the syntax should be something like this:

"DELETE * FROM ACCESS_TABLE WHERE ROWNUMBER = '99'

But I know that the last part is wrong. If anybody has a solution here I will be very greatful!

Regards
Jan erik
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
What's ROWNUMBER? An AutoNumber field? A user-maintainable field?

Are you trying to delete the 99th row in a table or are you trying to delete the unique record which has 99 in a particular field?

Perhaps you could show us the table?
 
Upvote 0
Jan

Is that the 99th row after sorting?

Is there any other way of identifying the specific row you want to delete?

The reason I ask is because in Access, like most databases, the 'row number' of a record isn't realy relevant.

Unless of course you are referring to a field with the value 99 in it.
 
Upvote 0
Hi,

I'll not sort the table or use a spesific field to identify the row. I know the pfysical ROWNUMBER and I want to use it as the identifier in the SQL command:-)

Jan Erik
 
Upvote 0
As Norie says, there isn't really the concept of a '99th record' in an Access table: Access may present the table to you in a particular sequence whereby the record you're interested in is displayed in the 99th row, but you can't reliably depend on that record actually being the 99th record in the recordset. It might be today or tomorrow, but one day it won't be.

You need to find a unique key for the record - some combination of data which identifies the record uniquely - and base your DELETE action on that.

(Of course if the unique key for that record is 99, then that's what you use.)
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top