473,327 Members | 1,976 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,327 software developers and data experts.

How to delete a row in form datasheet view by using right click-delete

167 100+
I have created a form in access 2007 and have the property set to 'datasheet view'. The record source is a query that displays duplicate rows. I want my user to be able to highlight a row and use right mouse click to delete the row. Currently, when I do a right mouse click, "delete row" is grayed out. I have set the "Allow deletions" form property to "yes" so I am not sure why it will not allow the delete.
Any ideas would be helpful!!

Thanks
Nov 2 '10 #1

✓ answered by BRawn

Good stuff :)

I'm assuming you're using the DataGridView control to populate your data into? Please correct me if I'm wrong...

What I'd do is the ContextMenuStrip control and add a delete MenuStripItem to it and on the right-click event of the delete index in the MenuStripItem, I'd run a query to remove the index of the CurrentRow of the DataGridView from the DataGridView and possibly the table you're running the populate query from as well, then run a refresh function when the delete is finished so the user can see the row he/she just deleted isn't in the list anymore.

If this is unfamiliar to you please let me know and I'll make a simple little application for you to demonstrate?

What language do you code in?

8 5537
you can delete the row on other way ..
pay create textbox >>
when you select ther row .. the record number while appear on the textbox
after that you can press the button delete to delete the row ,,,
Nov 3 '10 #2
ncsthbell
167 100+
I am not sure I am understanding what you are saying:
pay create textbox >> What?????
when you select ther row .. the record number while appear on the textbox
after that you can press the button delete to delete the row ,,,
What delete button????
Nov 4 '10 #3
BRawn
28
Instead of displaying duplicate records, why don't you use something like 'select distinct' or have a flag in your table with a boolean datatype?

That way you can do a select on only the data you want to see. Displaying duplicates can become a problem when there's a lot of data in your database...
Nov 4 '10 #4
ncsthbell
167 100+
My purpose is to allow my users to display any duplicates and evaluate them to determine which row to delete. I have a form that displays only duplicate rows.
Nov 4 '10 #5
BRawn
28
Are you trying to do this directly from Access or have you written an application?
Nov 5 '10 #6
ncsthbell
167 100+
I have written an application. I have a button on a form "Show duplicates". When clicked, I open a form (frmDups) which has the record source of a query that finds duplicates.
Nov 5 '10 #7
BRawn
28
Good stuff :)

I'm assuming you're using the DataGridView control to populate your data into? Please correct me if I'm wrong...

What I'd do is the ContextMenuStrip control and add a delete MenuStripItem to it and on the right-click event of the delete index in the MenuStripItem, I'd run a query to remove the index of the CurrentRow of the DataGridView from the DataGridView and possibly the table you're running the populate query from as well, then run a refresh function when the delete is finished so the user can see the row he/she just deleted isn't in the list anymore.

If this is unfamiliar to you please let me know and I'll make a simple little application for you to demonstrate?

What language do you code in?
Nov 5 '10 #8
ncsthbell
167 100+
I figured out a different way to do this. Could not get it to work as creating the form in datasheet view. Instead of opening a form with the duplicates query as the record source, I did docmd.openquery "myquery" and it run the query and returned the results in a datasheet view. I am able to highlight my record(S) and right mouse click and delete them. I am sure there is some way that it can be done by using the form but got tired of wasting time... tried it this way and it works so I am giving up the other way and go with this. Thanks everyone for the suggestions/help!!
Nov 5 '10 #9

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

Similar topics

11
by: yaktipper | last post by:
This explains how to disable the view source / right-click menu in Netscape 4, Netscape 6 and Internet Explorer (IE). <script language="JavaScript"> //This code is the beginning of the right...
5
by: Someone | last post by:
I know many don't like having right click disabled, however this is a unique case where clients using viewing this particular site will not be world wide so it's not going to affect too many...
3
by: FlyAway | last post by:
Is there a way that when someone right clicks, that it opens a new page, instead of just giving a message, as page is copyrighted? If so, can you give an example of the script code? Thanks
4
by: MacDermott | last post by:
I have an Access 2000 form with a subform in Datasheet view. When I click on an item in the header of the subform (the title at the top of one of the columns), I'd like to be able to capture the...
2
by: AgentX | last post by:
Is it possible, In a datasheet view subform, to change the backgound color based on the value in a particular field? For example if the field is Yes/No, have the background color red for No and...
1
by: chandu5090 | last post by:
Hi i have some nodes in the treeview. how can i select the node by directly right clicking on the node?
3
by: Hirsute | last post by:
Simple question for MS Access 2003 (using VBA)... I have "continuous" form (e.g. showing many records on a single form window). When I simply click (primary click) on one of those records it...
15
by: HyBry | last post by:
I have send mail button assigned to datasheet in subform. Works fine if I want to send mail to one person, but I want it to work if I have multiple selection as well. code I have now is ...
1
by: Henri.Chinasque | last post by:
Hi all, I've created a control, that when a user right clicks it, it will launch a form with some options. I would like this form to have typical "right click window" behaviour - when the user...
2
by: Ceylon | last post by:
Hi, 1. I am doing a simple timesheet model in Access. When i click on Review button with given dates, this will run a query to find the Username, Start Date, Break Start time, Break End Time and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
1
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...

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.