Results 1 to 5 of 5
  1. #1
    EricRex is offline Advanced Beginner
    Windows 11 Access 2021
    Join Date
    May 2024
    Location
    Colorado
    Posts
    85

    One Module for several slightly different forms

    Hey there,



    I have several forms that are slightly different but use the same code base to populate them. The existing modules literally only have a Form_Open Sub with a subroutine call to the common code base.

    Wondering how I can eliminate these redundant modules for these slightly different forms and just use one module for all of them?

    Thanks,
    Eric

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,285
    Would really help if you showed the code?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,706
    If the only code in the form's module is Form_Open, you can delete the modules and use this technique to call the common code:
    (Use your procedure name, but it must be a function)

    Click image for larger version. 

Name:	module.png 
Views:	26 
Size:	13.7 KB 
ID:	52056

  4. #4
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    I have several forms that are slightly different
    This can often be avoided by making one or two forms more flexible. Not enough info to say that is an option or not. Seeing the db would probably settle that.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    EricRex is offline Advanced Beginner
    Windows 11 Access 2021
    Join Date
    May 2024
    Location
    Colorado
    Posts
    85
    Quote Originally Posted by davegri View Post
    If the only code in the form's module is Form_Open, you can delete the modules and use this technique to call the common code:
    (Use your procedure name, but it must be a function)

    Click image for larger version. 

Name:	module.png 
Views:	26 
Size:	13.7 KB 
ID:	52056
    Awesome! This is exactly what I wanted.

    THANKS!

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

Similar Threads

  1. Replies: 45
    Last Post: 03-24-2023, 08:01 AM
  2. Passing Forms and Controls to a Module
    By MykelDL in forum Access
    Replies: 15
    Last Post: 12-07-2021, 02:31 PM
  3. Module for multiple forms
    By CraigR in forum Modules
    Replies: 3
    Last Post: 07-31-2019, 05:43 PM
  4. Replies: 4
    Last Post: 02-09-2015, 10:16 AM
  5. How hard can this be? Going slightly mad here Access to Mysql
    By trevormichaelfisher in forum Import/Export Data
    Replies: 6
    Last Post: 07-26-2014, 10:43 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