Results 1 to 2 of 2
  1. #1
    quicova is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2013
    Posts
    53

    Delete record from table from form with subform

    Hello everyone.

    I have a form with a subform

    the subform gets its data from a query which changes using the values on combo box in the main form.
    I'm using a sub from because I needed a continues style form instead of a list box.

    I need to make a bottom that will delete the item selected in the subform from the main table.

    I did bottom using macro but I was getting the error "The command or action 'DeleteRecord' isn't available now."
    so I'm trying o write the code in VB.

    this is what I have:


    Code:
            CurrentDb.Execute _
                "DELETE FROM Weights_Centers " & _
                "WHERE Weights_Centers.ID = " & Me.Add_to_Weights_SUB
    but I'm getting a type mismatch error on "Me.Add_to_Weights_SUB" and I can't see why
    can anyone help me out?

  2. #2
    quicova is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2013
    Posts
    53
    Got it

    if anyone had the same problem code should be:
    Code:
    CurrentDb.Execute _
                "DELETE FROM This_Table " & _
                "WHERE This_Table.ID = " & Me!This_Sub_Form.Form.ID

Please reply to this thread with any new information or opinions.

Similar Threads

  1. delete table record with VBA
    By msasan1367 in forum Access
    Replies: 6
    Last Post: 07-07-2013, 11:29 AM
  2. Replies: 4
    Last Post: 07-03-2013, 10:02 AM
  3. Delete record from nested subform
    By raton in forum Forms
    Replies: 1
    Last Post: 04-14-2012, 11:39 AM
  4. Replies: 2
    Last Post: 03-31-2012, 01:28 AM
  5. Replies: 0
    Last Post: 01-06-2009, 02:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums