Results 1 to 5 of 5
  1. #1
    MattBaldry is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Location
    Hampshire, UK
    Posts
    11

    Module Advice

    Hello all,

    I have been slowly building a decent size database over a few years and am now thinking of rebuilding it with better coding I have learned over the years. With regards to modules, I have been moving everything over to public functions. The advice I am after is about the most efficient way to have this designed.

    As an example I have an cmdAdd function. Now, here is where I want feedback/input. The cmdAdd function has different options depending on which form you are on. At the moment I have the code checking with form it is on and then performing that version of the cmdAdd. Let's say I want to add a new quote, it looks for frmCustomerOverview and then runs the cmdAdd in the add quote part. If it was on a different form it would perform a different function.

    Is this an efficient way to code things, or would I be better having a cmdAddQuote as a stand alone function, and so on for all the other functions. At the moment the cmdAdd has 10 different forms with different add functions on each one.

    My thoughts in doing it this way was that all the add functions were in one code and easy to find and manage, I was just not sure on the performance issues doing it this way.



    Regards,

    ~Matt

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    don't think it will have a significant effect on performance and if the code is different for each form, then I don't see the benefit of putting it in a public function on a general module Unless the only difference is say the name of a subform - in which case you can pass that as a parameter.

  3. #3
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Your database size is going to come from data,not code.

  4. #4
    MattBaldry is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Location
    Hampshire, UK
    Posts
    11
    Quote Originally Posted by Ajax View Post
    don't think it will have a significant effect on performance and if the code is different for each form, then I don't see the benefit of putting it in a public function on a general module Unless the only difference is say the name of a subform - in which case you can pass that as a parameter.
    Quote Originally Posted by ranman256 View Post
    Your database size is going to come from data,not code.
    Thank you for the quick replies. I shall move all my code back onto the forms. The Analyser suggests moving all the code to modules, should I disregard this comment from MS Access?

    ~Matt

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    depends on the code.

    There is a benefit with forms that have no code (i.e. has module is set to false) - they will open faster although not sure how much that will be noticeable with modern computers. Of more impact to form opening is what the code actually does and the recordsource

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

Similar Threads

  1. Advice please
    By eddcole in forum Forms
    Replies: 7
    Last Post: 01-03-2017, 12:29 PM
  2. class module vs regular module
    By Madmax in forum Modules
    Replies: 1
    Last Post: 05-01-2012, 03:44 PM
  3. Need some advice and help
    By winterh in forum Access
    Replies: 9
    Last Post: 04-18-2012, 06:41 AM
  4. Replies: 4
    Last Post: 05-16-2011, 04:58 PM
  5. Need advice on what I have so far
    By rumplestiltskin in forum Database Design
    Replies: 2
    Last Post: 05-25-2006, 12:48 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