Results 1 to 3 of 3

Thread: Save

  1. #1
    Join Date
    Jun 2006

    Unanswered: Save

    Does Data in Microsoft Access Forms save automatically? I want to know if there is a need to include save command buttons on my form. When the user closes the form, I don't want data to be saved to the tables. Only when the user click the save command button, should data be saved to the respective tables.

  2. #2
    Join Date
    Jul 2003
    If your form is "bound" to a table (or updatable query), it will save directly
    to the table when the user leaves a record. This is rarely a good idea, since
    users are adept at finding ways to put data in that doesn't blend well with your other data.
    It's best to build the form without a recordsource, and use
    VBA to populate the form. You can then put a "Save" button on it, that is
    coded to validate the data, and save it.
    Inspiration Through Fermentation

  3. #3
    Join Date
    Jun 2006
    Thanks, I created a save command button which prompts the user for saving. The code used is as follows:

    Private Sub cmdSaveForm_Click()
    Select Case MsgBox("Save changes?", vbYesNoCancel)
    Case vbYes 'Do nothing: it saves by default.
    Case vbNo 'Undo the changes, and close.
    Cancel = True
    Case vbCancel 'Don't close, and don't save.
    Cancel = True
    End Select
    End Sub

Posting Permissions

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