Results 1 to 4 of 4
  1. #1
    Evilferret is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    27

    Reusing VBA Code To Update A Table

    I have a table that I want to update (via VBA) prior to any any data being retrieved from it.

    Is there a way to do this so that I don't need a separate copy of the update code for each different object that would require the table to be updated?


    Is there some way to make a global VBA function and call it whenever I need to update?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I'm sure there is, but I suggest you give us an example with some data to show us exactly what you mean.


    Have you considered using a parameter query? It may be suited to your needs - maybe not.

    Can you tell us more about

    for each different object that would require the table to be updated

  3. #3
    Evilferret is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    27
    The table in question is a temp table that needs to link together a set of records each time a report is run. There are various reports that would make use of the table. The code that would need to be run is a big chunk of VBA that builds the temp table.

    Looking at this now I realize that my temp table approach is inefficient. I should really be linking/relinking the tables together as the data is entered/updated rather than building a temp table on the fly.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    An example would facilitate our understanding your situation.

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

Similar Threads

  1. Writing Code for "After Update" Table Events
    By dipique in forum Programming
    Replies: 10
    Last Post: 07-09-2012, 08:11 AM
  2. VBA code to update field in table
    By vickan240sx in forum Access
    Replies: 1
    Last Post: 06-23-2012, 08:24 PM
  3. Replies: 1
    Last Post: 02-08-2012, 04:50 PM
  4. Before Update code
    By jms in forum Forms
    Replies: 1
    Last Post: 03-10-2011, 11:28 AM
  5. Replies: 3
    Last Post: 04-14-2010, 10:07 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