• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. Using Procedures > Declaring Procedures as Public or Private

Declaring Procedures as Public or Private

You won’t always see procedures declared with just the Sub or Function keyword. There are various modifiers that can go in front of these keywords. Two of the important modifiers are Public and Private. A public procedure can be called from anywhere within your Access VBA code. A private procedure can only be called from within the module where it is declared. Here’s how these declarations look, in procedures that don’t actually do anything:

Public Sub Procedure10()
  ' Can be called from anywhere
End Sub

Private Sub Procedure11()
  ' Can only be called from this module
End Sub

Public Function Procedure12()
  ' Can be called from anywhere
End Function

Private Function Procedure13()
  ' Can only be called from this module
End Function


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint