Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2005
    Posts
    196

    Unanswered: Only save to table on an event on a bound form

    Hi, is it possible to have a bound form with text boxes bound to fields in a table, which when these text boxes are changed they will only be saved in the table when clicking a button (or on any chosen event)? Otherwise they don't write to the table if certain conditions are not met (e.g saying no to "Do you want to save changes)? Or is using unbound forms with ADO or DAO the only way of doing this? I already know the ADO method, just wondering if I can save myself from fully recoding a form.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    One idea might be to use the On Dirty event of the form.
    Code:
    Option Compare Database
    Option Explicit
    
    Dim Changed As Boolean
    
    Private Sub Form_Dirty(Cancel As Integer)
    Changed = True
    End Sub
    Then use the On Current event to check if your variable is true or not!
    George
    Home | Blog

  3. #3
    Join Date
    Aug 2005
    Posts
    196
    Many thanks for your help. The main issue I have is when you make a change to the data in the text boxes (which are bound to the table), how can you stop it from writing data to the table, or undo if the user says no to saving changes when closing the form (from which your example will aid me to detect if there are changes)?

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    This might do it for you
    Code:
    DoCmd.RunCommand acCmdUndo
    George
    Home | Blog

  5. #5
    Join Date
    Aug 2005
    Posts
    196
    Many thanks for that - I'll give it a go and report back for the benefit of future post searches.

  6. #6
    Join Date
    Aug 2005
    Posts
    196
    Quote Originally Posted by georgev
    This might do it for you
    Code:
    DoCmd.RunCommand acCmdUndo
    Yep it works. Exactly what I was looking for. Many thanks for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •