Results 1 to 4 of 4
  1. #1
    Tvanduzee is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    39

    Delete from table after commit

    Hello

    In my main form of a form/subform, I have a combo box that allows selecting from a table via query.
    How do I know when the record of the form is committed to the db? After Access commits the record, I then need to go back to the table and remove the valued that was dropped down in the combobox.
    This is only a temporary holding table for available values. Once the value is used and put into the permenant table, I need to remove that value from the temp table.

    So, how can I find out when the record is committed? Because I know users can simply quit in the middle of filling in a record.


    Before removing the value from the temp table, I have to be "sure" the value is going to be in the permanent table before removing from the temp table.

    Thank You
    Terry

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    You could run a DLookup on the table.

    How are users quitting the data entry? Record entry/edit is committed to table when form closes, move to new record, or run code. Unless users hit ESC key couple of times, any edits they did will be saved, or there is a custom CANCEL button on form that will undo entry/edits before form closes.
    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.

  3. #3
    Tvanduzee is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    39
    When users are done, they click the "Done" button, which runs a macro to save the entry, then runs a function to remove the Work Order number from the temp table. But, as you mentioned, if they hit escape the entry is cancelled, but will the Work Order number be entered into the permanent table?

    Can you point me to info on customizing a cancel event to rollback any changes?

    Thanks
    Terry

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If you use code to populate the WorkOrder number field, not sure ESC or Undo will remove the value from the field. Would have to do some testing. Here is sample code from my project. Sending ESC is not supposed to be best method but I was not succeeding with Undo action.
    Code:
    Private Sub btnCancel_Click()
    If Me.OpenArgs Like "Edit*" Then
        SendKeys "{ESC}", True
        SendKeys "{ESC}", True
        DoCmd.Close acForm, Me.Name, acSaveNo
    Else
        Call ViewData("Quit")
    End If
    End Sub
    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. Form/Subform commit row error
    By jbickl in forum Forms
    Replies: 2
    Last Post: 03-31-2012, 07:19 PM
  2. Replies: 2
    Last Post: 01-24-2012, 02:16 PM
  3. Replies: 11
    Last Post: 03-30-2011, 01:08 PM
  4. commit row error
    By appiades in forum Forms
    Replies: 0
    Last Post: 07-05-2010, 05:32 PM
  5. Commit row in form
    By windwardmi in forum Forms
    Replies: 3
    Last Post: 04-29-2010, 03:31 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