Add a button in Access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • margot
    New Member
    • Sep 2007
    • 48

    Add a button in Access

    Hello, I have created a button that adds data to a table. However I would like that when I press the button a message appear saying that data was updated. Can someone help me? Thanks in advance.
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    In the code behind your button

    [CODE=vb] Msgbox "Data has been updated!"
    [/CODE]
    Linw ;0)>

    Comment

    • margot
      New Member
      • Sep 2007
      • 48

      #3
      Originally posted by missinglinq
      In the code behind your button

      [CODE=vb] Msgbox "Data has been updated!"
      [/CODE]
      Linw ;0)>
      Thank you, but I created the button using the macro builder. So how can I add this feature? Thank you

      Comment

      • mshmyob
        Recognized Expert Contributor
        • Jan 2008
        • 903

        #4
        I would also put this inside an Onerror event to ensure nothing went wrong with the update otherwise the user might think everything did get updated when it didn't.

        Originally posted by missinglinq
        In the code behind your button

        [CODE=vb] Msgbox "Data has been updated!"
        [/CODE]
        Linw ;0)>

        Comment

        • margot
          New Member
          • Sep 2007
          • 48

          #5
          Originally posted by margot
          Thank you, but I created the button using the macro builder. So how can I add this feature? Thank you
          Thank you, I was able to do it through micro builder. However how can I clear all the fields after the data was updated.
          Thank you in advance.

          Comment

          • mshmyob
            Recognized Expert Contributor
            • Jan 2008
            • 903

            #6
            Just click on the little button to the right of the Onclick-Event under properties. This will bring up the Macro builder.

            Then add a line in and chose MsgBox under Actions and add "Data Updated" in the Message argument at the bottom of the screen.

            The problem with doing it there and leaving the default error trapping like Access has it is that if you get an error the message will still pop up.

            Best bet is to program it yourself but that is just my opinion.

            Originally posted by margot
            Thank you, but I created the button using the macro builder. So how can I add this feature? Thank you

            Comment

            • margot
              New Member
              • Sep 2007
              • 48

              #7
              Originally posted by mshmyob
              Just click on the little button to the right of the Onclick-Event under properties. This will bring up the Macro builder.

              Then add a line in and chose MsgBox under Actions and add "Data Updated" in the Message argument at the bottom of the screen.

              The problem with doing it there and leaving the default error trapping like Access has it is that if you get an error the message will still pop up.

              Best bet is to program it yourself but that is just my opinion.
              Thank you, through the macro builder can I have a clear option that after the data is updated the fields will be clear?

              Comment

              • missinglinq
                Recognized Expert Specialist
                • Nov 2006
                • 3533

                #8
                If this is a bound form, the way to "clear all the fields" is to move to a new record.

                Linq ;0)>

                Comment

                Working...