473,324 Members | 2,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Delete rows between 5 to 10 from a access table.

For Example:
I have a table with 20 rows. I want to delete rows from 5 to 10 using query.
Dec 31 '10 #1
1 1573
Stewart Ross
2,545 Expert Mod 2GB
You really need to find some means of identifying which rows you want to delete other than by their position. Relational databases do not in general have any concept of position, which is a logical order imposed on the underlying data and not inherent in the data itself. In an Access database records are listed in an order which depends on current choice of primary key, or sort parameters if you use a query based on a table.

If there is no primary key defined then records are listed in the order they were added.

Whilst it is possible to use VBA to process a recordset in a loop, for the very small number of records you have mentioned I'd simply suggest that you open the table and manually delete the records you don't want to keep. It will be a lot quicker than trying to automate the task using a loop and a recordset to do so.

You mention the use of a query to delete rows 5-10; given the very small number of rows involved I guess this is some form of assignment question, as I see no practical application for what is asked. There are ways and means to do combinations of SELECT TOP on the table, but you'll have to work that out for yourself if indeed this is some form of assignment.

-Stewart
Dec 31 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: C.P. | last post by:
I need a script that will delete the first 100000 rows of a table. Is this possible?
11
by: suma | last post by:
Hello, I want to delete duplicate rows in a table when no primary key is defined. For eg: If we have table1 with data as below, Suma 23 100 Suma 23 100 I want to delete a row from this...
3
by: Matthew Kramer | last post by:
If I'm at row 10,000 of an Access table with 60,000 lines. Is there some way I could highlight all the rows from row 10,000 to the end of the table (row 60,000) in an easy way rather than having...
1
by: sandeepk84 | last post by:
hi all... can anyone tell me how we can use rowcount to delete some rows from a table.. means, i have some rows in d table. and i have to delete some rows (from beginning) based on some...
1
by: SteveBark | last post by:
Hello all I am currently trying to develop a script that will take a value from an Excel spreadsheet cell and use that to run a query against an Access table to delete all rows that match the...
1
by: madhavi123 | last post by:
Hi All, I have tables in three hierarchy... I need to delete rows from the table which in 3rd level of hierarchy. For ex: Table 1 has primary key col1. Table 2 has primary key...
1
by: abdulkarim | last post by:
I have tried to delete rows in a table with same ID in access database by using the following vb code with a click on command button, but it deletes only a single row instead of entire rows with same...
3
by: =?Utf-8?B?S2F5xLFoYW4=?= | last post by:
In my project,i added datagridview to my form , i transfered my table to datagridview and added multiple rows and when i called dataadapther.update ,,result is ok. But when i tried it for the...
2
by: tanuja5 | last post by:
hi.. how to delete the selected row in datagridview using ContextMenuStrip.When i right-click and press "delete" the seleted row in the dataGridView has to be deleted and as well in my access...
3
by: lisles | last post by:
hey,i've got a page that displays rows from a db.im want a function to dynamically delete rows.i've put it 1,bt i get an error as follows: Parse error: syntax error, unexpected T_STRING, expecting...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.