Results 1 to 4 of 4
  1. #1
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142

    Form Delete Current Record

    This seems like a basic question, I apologize in advance.



    I have a dialog form that needs to delete its own current record when closing IF certain criteria are met.

    The data source is a table, the table has 4 currency fields, the table validation rule does not allow ALL 4 of these fields to be zero.
    Table validation rule:
    Code:
    Not ([field1]=0 And [field2]=0 And [field3]=0 And [field4]=0)
    That said, if the user attempts to *update* a record such that all 4 fields = 0, that means the record needs to be deleted all together. I attempted to do this in the From_BeforeUpdate event but was unsuccessful, what's the best way to approach this?

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    If it made it in the table in the first place you should maybe display a warning message and set the Cancel=True in the beforeupdate instead of trying to delete it.

    Cheers,
    Vlad

  3. #3
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142
    I still need to delete it.

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    DoCmd.RunCommand acCmdDeleteRecord

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

Similar Threads

  1. Replies: 5
    Last Post: 08-18-2018, 10:23 AM
  2. Make last record in Form's RecordSource the current record
    By GraeagleBill in forum Programming
    Replies: 6
    Last Post: 06-27-2018, 10:43 AM
  3. Replies: 3
    Last Post: 02-06-2015, 01:18 PM
  4. Replies: 3
    Last Post: 10-19-2012, 04:30 PM
  5. VBA delete current record continuous form
    By tylerg11 in forum Forms
    Replies: 3
    Last Post: 02-17-2012, 12:57 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