Results 1 to 2 of 2
  1. #1
    sneuberg is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2014
    Posts
    23

    Don't want the delete button on a subform with a new record

    I have a main form with a subform in continuous format. The subform displays the list of records and has a delete button allowing the user to delete that line (record) All works except if the user clicks the delete button on the new record line. This results in the error, “The command or action DeleteRecord isn’t available now”. This makes sense as this new record doesn’t exist. I’d like to have the delete button only appear on the subforms with records that have been saved and not on the subform with the new record. I can’t seem to find the right events to make this happen. I tried putting the code below in the subforms on load event, but when that fires it make the button disappear on all of the subforms. I could use some help.

    If Me.NewRecord then


    Me.DeleteBTN.Visible = False
    End IF

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    This won't work because the form is continuous (or datasheet) and there is only one button. Changing the property affects all instances of the control.

    Try the OnCurrent event.

    Or maybe trap the error with an error handler.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Delete record button from table using listbox
    By Ruegen in forum Programming
    Replies: 5
    Last Post: 09-08-2014, 09:02 PM
  2. Replies: 7
    Last Post: 11-30-2013, 12:33 PM
  3. Delete Entry from subform using button
    By jobatiikanawong1987 in forum Access
    Replies: 1
    Last Post: 08-08-2013, 11:37 AM
  4. Replies: 4
    Last Post: 07-03-2013, 10:02 AM
  5. Command button help - delete record
    By Zukster in forum Forms
    Replies: 0
    Last Post: 08-27-2009, 08:47 AM

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