Rand,
In most cases, the probable cause is in relation to the scope of the function or subroutine. Functions and subroutines that are declared as "Private" are available only to the module, form, or report in which they are defined or reside. Functions and subroutines that are declared as "Public" are available to ALL forms, reports, and modules within your application.
For example, a form may have a command button to close the form named "cmdCloseForm". The subroutine to execute that is associated with that button on that form will be named "Private Sub cmdCloseForm_Click()". Because this subroutine in this form was declared as "Private", the cmdCloseForm_Click() process will only run for the current form in which it is declared. Also, though, because cmdCloseForm_Click was declared as Private to that form, you can include a subroutine with the exact same name in every form, as long as each of them is declared as Private.
On the other hand, you may have a function that needs to be available for all forms to check for a valid part number that would be entered by a user named "ValidatePartNumber()". In this case, you would probably want to include this function in a module where it would be easy for you to find, and then declare the function as "Public" as in "Public Function ValidatePartNumber()" which would make it not only available to all forms, but any other part of the application as well.
Hope that helps.
Warren
:D
|