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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ncsthbell
    New Member
    • May 2007
    • 167

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

    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
  • osama Abboshi
    New Member
    • Nov 2010
    • 2

    #2
    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 ,,,

    Comment

    • ncsthbell
      New Member
      • May 2007
      • 167

      #3
      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????

      Comment

      • BRawn
        New Member
        • Jul 2010
        • 28

        #4
        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...

        Comment

        • ncsthbell
          New Member
          • May 2007
          • 167

          #5
          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.

          Comment

          • BRawn
            New Member
            • Jul 2010
            • 28

            #6
            Are you trying to do this directly from Access or have you written an application?

            Comment

            • ncsthbell
              New Member
              • May 2007
              • 167

              #7
              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.

              Comment

              • BRawn
                New Member
                • Jul 2010
                • 28

                #8
                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 ContextMenuStri p 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?

                Comment

                • ncsthbell
                  New Member
                  • May 2007
                  • 167

                  #9
                  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!!

                  Comment

                  Working...