Results 1 to 4 of 4
  1. #1
    CraigR is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    27

    Post Calling a module into a form

    Hi and Thanks hopefully in advance



    I have a module called PODS
    I have a form with a dropdown field called Sitings

    I want the "After Update" -> Event Procedure

    Private Sub Sitings_AfterUpdate()
    Call PODS 'calls the PODS module

    End Sub

    I don't know how to correctly call the module into the event

    Craig

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You don't call the module, you call the name of the function/sub within the module that you want to execute (since a module can contain multiple subs/functions). So:

    Call SubName

    or simply

    SubName

    This may help:

    http://www.baldyweb.com/Function.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    if PODS is public, then you can just call it from anywhere.

    Code:
    public sub PODS()
       'your code here
    end sub

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You don't "Call a Module". You call procedures (subroutines). A module is a container.

    If a module (modUtilities) has a sub named "MySub" and a function named "fnCalcArea", you could utilize them like this:

    Sub Example
    Code:
    Private Sub Sitings_AfterUpdate()
          Call MySub    'calls the MySub routine
    
    End Sub


    Function Example
    Code:
    Private Sub Sitings_AfterUpdate()
       Dim MyArea as Single
    
       MyArea = fnCalcArea(5, 4)  'uses a function to calculate an area
    
    End Sub

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

Similar Threads

  1. Replies: 5
    Last Post: 11-25-2017, 03:45 AM
  2. Procedure not calling in a sub form
    By tcheck in forum Access
    Replies: 12
    Last Post: 08-24-2016, 02:45 PM
  3. Replies: 3
    Last Post: 12-17-2015, 10:46 AM
  4. Replies: 4
    Last Post: 05-16-2011, 04:58 PM
  5. Calling A Module Function To Open A Form
    By orcinus in forum Modules
    Replies: 3
    Last Post: 09-29-2010, 04:43 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