How to retrieve selected record from subform datasheet and insert into a table?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • David Patz

    How to retrieve selected record from subform datasheet and insert into a table?

    Is it possible for a user to select a record from a datasheet in a subform, double click it, and write that specific record to another table? I have attempted to perform this task using DoCmd.DoMenuIte m commands and RunCommand acCmds but with no luck? Im currently building this system in VBA with MS Access 2003. Thus far I have only been able to copy the selected record to a the windows clipboard to be used in other text-based platforms, but I need to write this information to a temporary table for data-manipulation. The subform is running a query to filter information based on a combobox.

    Any help will be greatly appreciated.

    Code:
    Private Sub Form_DblClick(Cancel As Integer)
    If MsgBox("Are you sure you want to activate this part?", vbYesNo) = vbYes Then
        RunCommand acCmdSelectRecord
        RunCommand acCmdCopy 'This copies the information to the clipboard.
        
        'These are methods I attempted to use - but ultimately do the same thing.
        
    '    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    '    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    '    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70
    
        Else
        Exit Sub
    End If
    End Sub
  • RuralGuy
    Recognized Expert Contributor
    • Oct 2006
    • 375

    #2
    Here's a link that will help to bring those DoMenuItem commands up to the RunCommand level. Much easier to understand if nothing else. http://www.accessruncommand.com/domenuitem.htm

    Comment

    • David Patz

      #3
      Thanks for the link - helped me understand more about how the menuItems work. Unfortunately my problem still stands and it seems as though none of the items available (under RunCommand or DoMenuItem) can perform the necessary function I require.

      Comment

      Working...