Results 1 to 2 of 2
  1. #1
    Monterey_Manzer is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    164

    Passing values vs. objects

    Hi All,



    I have what may be a philosophical question. Is there something inherently wrong or wasteful about passing an entire object to functions/subs rather than assigning the values needed to variables and passing those through your call stack? I'm trying to operate by the general "one page" rule of thumb for my subs and functions but just the process of handling all the decision making code is making my subs rather long and I'm trying to find a way to simplify. Basically what I want is to have just one level of decision making code for each sub or function and in some cases that requires passing an entire form or report object to other subroutines or functions so that an additional layer of decision making can be handled by a separate chunk of code. My desire for simplified code is starting to be satisfied but it requires me to pass entire form or report (or error) objects to other functions/subs. This hasn't caused any problems or slowed performance appreciably thus far but if someone has some experience with the potential pitfalls of this approach I would appreciate any insight anyone could give.

    Thanks!
    Ryan

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Usu you just pass the value. You only need to pass objects if you are dealing with lots-o-objects.

    {extreme example}
    Like a form with many combo box filters. Each combo uses a different query, but the same method to fill it.
    Users picks the filter to use, so pass a combo box type to the routine to be filled.
    All combos have the same properties, so 1 set of code can be used to do all the same type.

    So under normal functions...pass value.

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

Similar Threads

  1. Passing values to another form
    By jlt199 in forum Forms
    Replies: 11
    Last Post: 02-25-2014, 04:50 PM
  2. passing values from form to query
    By gregd in forum Access
    Replies: 6
    Last Post: 05-02-2013, 03:18 PM
  3. passing values between forms
    By paulw in forum Access
    Replies: 4
    Last Post: 06-15-2011, 08:52 AM
  4. PASSING Values between Forms
    By chhinckley in forum Programming
    Replies: 1
    Last Post: 08-27-2010, 10:19 AM
  5. Passing Values
    By dromorkid in forum Forms
    Replies: 0
    Last Post: 11-25-2008, 05:04 PM

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