Results 1 to 7 of 7
  1. #1
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265

    Using the Form.BeforeUpdate property

    I have a form called "Gymnast." I am setting the BeforeUpdate property of the form I am currently so that it will run an event procedure just like the Microsoft website says.

    Upon detecting a change, the form would initiate a procedure called "trigger" which would display a message box.

    I have a screenshot attached.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,818
    Odd looking code. In what procedure is the line Me.BeforeUpdate = "[trigger]"?

    What is your question?

    Where on MS website did you find instructions for this - do you have link?
    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
    Demerit's Avatar
    Demerit is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2013
    Posts
    125
    That code cannot do any good. as a matter of fact, there is no even procedure. Is Trigger a control on the form or is it a form on its own?

    Re-structure your question and post it.

  4. #4
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by Demerit View Post
    That code cannot do any good. as a matter of fact, there is no even procedure. Is Trigger a control on the form or is it a form on its own?

    Re-structure your question and post it.
    I'm just doing this to get an idea of how the BeforeUpdate property works and also how to use a property that represents an Event. Here is what I was thinking.

    1. Since I have the code Me.BeforeUpdate = [trigger], and since this code lies in the code window for the form Gymnast (which is the form I currently have open). I thought that the form would now have this property.
    2. Therefore after I make a change in a text field and tab out, this would invoke the .BeforeUpdate property
    3. Because this property is now invoked, it would run the sub routine called 'trigger.' This trigger sub routine is not a part of any particular control. It is standing by itself as a part of the form Gymnast since it lies in the coding window for the form called Gymnast.

    I know I can add trigger under the Event procedure in the Events tab. But I just wanted to:

    1. Get an idea of how to code this property and invoke a procedure.
    2. Get an idea of how the syntax for this property is used (see the last line of this post), e.g. does trigger go in [ ] or not? Do you use " " or not?


    Here is the MS website: http://msdn.microsoft.com/en-us/libr.../ff822073.aspx

    Here is the syntax they posted: Forms(0).BeforeUpdate = "[Event Procedure]"

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,818
    That site is not showing a complete procedure. It shows only one line. A procedure must start with a declaration as a Sub or a Function, like:

    Sub Command0_Click()

    Function MyFunctionName()

    I have never used BeforeUpdate property, only BeforeUpdate event procedure.

    I have no idea how this can be useful.
    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.

  6. #6
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by June7 View Post
    That site is not showing a complete procedure. It shows only one line. A procedure must start with a declaration as a Sub or a Function, like:

    Sub Command0_Click()

    Function MyFunctionName()

    I have never used BeforeUpdate property, only BeforeUpdate event procedure.

    I have no idea how this can be useful.
    I know that the words 'event procedure' represents code, but what I was wondering is if you ever had to use this, do you leave off the [ ], do you use the " " or neither? I couldn't get that to work. I know that you know a lot about Access, so if you have never used the BeforeUpdate property, that gives me some relief. I was looking into how to use this property in anticipation that I might have to use it one day.

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Seems like the property could be used to do something like open a pdf file, print a report, open another form. It will probably be more usefull to understand the On Before Update event handler for forms and controls. Like June, I have not used the property but have used the Event Handler for Before Update

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Beforeupdate to early
    By R_Badger in forum Forms
    Replies: 3
    Last Post: 02-09-2012, 10:38 AM
  2. exit form using BeforeUpdate 'or' cmdButton
    By ConfusedMike in forum Forms
    Replies: 9
    Last Post: 09-21-2011, 10:05 PM
  3. BeforeUpdate in a Form in Datasheet view
    By fitshase in forum Forms
    Replies: 7
    Last Post: 07-29-2011, 08:53 AM
  4. Validation BeforeUpdate Errors
    By huv123 in forum Programming
    Replies: 3
    Last Post: 02-07-2011, 10:25 AM
  5. BeforeUpdate and AfterUpdate Question
    By gsurfdude in forum Programming
    Replies: 0
    Last Post: 04-03-2008, 07:56 AM

Tags for this Thread

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