close form macro

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mindy

    close form macro

    I have two questions here:
    (1) what is the difference of close form and close table?
    (2) How "Prompt" works
    I used close form macro in my database. I hope when a user close the
    form, he/she will be asked if he/she wants to save the form (actually,
    I hope the user could decide if he or she want to add the new data to a
    database). I chose "prompt" in "Save" option of close macro. But there
    is no difference if I chose "yes" in "save" option. Anyone knows the
    difference? Thanks.

    Mindy

  • Anton

    #2
    Re: close form macro

    Hi again Mindy,

    Access automatically updates and adds data when closing a form. In
    order to trap a response from your users you might like to add a bit of
    VBA code in the Before Update event section on the form you want to
    check. Remember however, that providing prompts to users is a very
    useful aspect of UI design, however repetitious prompting can make an
    otherwise nice db quite tedious to use (personal thoughts...). You
    might simply inform your users that if they don't wish to update the
    form's data that they can use the ESC key twice to clear the current
    form's data and then close.

    If you do want to provide promts something like should do what you
    want.

    If MsgBox("Do you want to save this record?", vbQuestion + vbYesNo,
    "Save") = vbYes Then
    DoCmd.Close
    Else
    MsgBox "If you want to cancel saving this form press the ESC key twice
    and then close again.", vbInformation + vbOKOnly, "Informatio n"
    DoCmd.CancelEve nt
    End If

    Comment

    • pietlinden@hotmail.com

      #3
      Re: close form macro

      (1) Tables and forms are different types of objects... what are you
      trying to do? Closing any kind of object does the same thing - removes
      it from memory and all that fun.

      Comment

      • Mindy

        #4
        Re: close form macro

        I am asking this question because I was confused about the data process
        of ACCESS. Form is used to enter data to table, but at what time data
        is saved in table, the time we close the form, or the time we enter
        data to the field. Considering the safety issue, should we close the
        form once we finish entering data? Thanks.

        Comment

        • Rick Brandt

          #5
          Re: close form macro

          Mindy wrote:[color=blue]
          > I am asking this question because I was confused about the data
          > process of ACCESS. Form is used to enter data to table, but at what
          > time data is saved in table, the time we close the form, or the time
          > we enter data to the field. Considering the safety issue, should we
          > close the form once we finish entering data? Thanks.[/color]

          Normally the record is saved when you leave the record.

          That can be from...

          Closing the form
          Navigating with the navigation buttons
          Applying a filter
          Removing a filter
          Moving focus from main form to subform
          Moving focus from subform to main form

          You can also save by pressing Shift-Enter or by calling save from the main menu.

          You can also have your own save button that uses code...

          Me.Dirty = False
          or
          DoCmd.RunComman d acCmdSaveRecord

          --
          I don't check the Email account attached
          to this message. Send instead to...
          RBrandt at Hunter dot com


          Comment

          Working...