Results 1 to 4 of 4
  1. #1
    karmacable is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    24

    Multiple 'AfterUpdates' referring to single Function

    Hi All,

    This is more of an efficiency in coding posting than an issue. I currently have a bunch of comboboxes with their 'AfterUpdate' control referencing the same public function, so the format of my coding (not the actual long code, swapped out names/number for ease of reading);

    Public Function CalcTotals
    CalcTotals = 1
    End Function



    Private Sub cbo1_AfterUpdate()
    CalcTotals
    End Sub

    Private Sub cbo2_AfterUpdate()
    CalcTotals
    End Sub

    etc., etc...............

    So imagine the Private 'AfterUpdate' Subs littering my VB page. I'm just wondering if there was a way to re-write so there's only one area for CalcTotals and all 'AfterUpdate's are referenced, make my page look cleaner. I guess something that would look like;

    CalcTotals()
    --cbo1_AfterUpdate()
    --cbo2_AfterUpdate()

    I know that example wouldn't work, just wondering if there's a syntax or way to get it close to that.

    Thanks for any advice!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Not really. You can put:

    =CalcTotals()

    directly into the after update property in the properties window, so it says that instead of "[Event procedure]". Same effect, but no "litter".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    karmacable is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    24
    That's really helpful to know! Thanks....

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    No problem!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Single Form, Multiple Options
    By forrestapi in forum Forms
    Replies: 4
    Last Post: 06-30-2011, 07:09 AM
  2. Multiple records on a single page
    By neo651 in forum Forms
    Replies: 1
    Last Post: 06-29-2011, 10:21 PM
  3. Create Multiple Charts from Single Table
    By Catch Wrestler in forum Reports
    Replies: 0
    Last Post: 06-17-2010, 08:33 AM
  4. Replies: 1
    Last Post: 02-02-2010, 07:19 AM
  5. Multiple UPDATE in single query
    By nishezaman in forum Access
    Replies: 0
    Last Post: 12-13-2009, 01:40 AM

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