Topics Search

call functions in another module

call functions in another module
Views: 14
1) Sub main()
2) Call mod1.fn1
3) Call mod1.fn2
4) End Sub
this function which is in mod2 calls only function 1 but not function 2.
Sponsored Links:

Similar posts...

 

Class module vs regular module

Class module vs regular module Icon
Trying to figure out the difference between these two items. still VBA shaky and not sure which to use to call functions from.
 

How to call module using commandline

How to call module using commandline Icon
I am using access 2000 and OS is XP. how to call module using command line. that's I have to invoke the module exclusively.
 

How do i run a module in Access?

How do i run a module in Access? Icon
I am using Access 2010 and am running a query to search for a specific substring within a field to return the records that contain only that substring. I have created a module that would be able to test for the substring and return a value of 1 or 0 depending on if it was found but I do not know how to integrate that module into the query.

is there a way in SQL view that ican call the module, and would I have to pass values to it from the table to run properly?
 

Modules, Procedures, and Functions

Modules, Procedures, and Functions Icon
A module is a file that holds code or pieces of code that belong either to a form, a report, or is simply considered as an independent unit of code. This independence means that a unit may also not belong to a particular form or report. Each form or report has a (separate) module.
Topics: Modules, Sub Procedures, Functions, Accessories for Programming, Techniques of Passing Arguments, Programmer-Defined Data Types, Introduction to Built-In Functions and Procedures,
Message and Input Boxes.
 

Better organization of functions and procedures: form modules vs standard modules

Better organization of functions and procedures: form modules vs standard modules Icon
I need a good resource for better understanding some of the subtleties of writing better/faster/ more efficient VBA code.

Can someone tell me what the pros and cons are of moving functions and/or procedures to standard modules instead of the form module where it is used? I can see where it's beneficial to have a single procedure, such as Allen Browne's "DoMouseWheel" to enable the mouse wheel to scroll through records on many different forms, but is there a speed advantage in terms of the formloading faster if the functions are stored in a standard module? If so, what's the disadvantage? I've been writing VBA code for several years, and some of my forms have rather long codes,but I don't know when it's proper to move some of that to a standard module.

I've also seen/borrowed modules where a function calls several sub functions to accomplish a task rather than having of the code under one function. I don't understand the advantages ofthis, either,
 

Where Can I Get Info On Modules

Where Can I Get Info On Modules Icon
I would like to know how to create a public module and how can I call that module.
Can anyone suggest me a website where I can learn about modules preferably with video's
 

Custom function inside SQL query (Access VBA)

Custom function inside SQL query (Access VBA) Icon
I'm trying to use a custom (user-defined) function inside an SQL query. When the function is in a normal module, the code works fine, but when the function is in a Class Module, Note: I have made sure the Function is Public in the Class Module. The Routine that creates and executes the SQL command is in the Class Module.

Is it forbidden to call a function residing in a Class Module from an SQL query, or am I missing something?
 

Useful Report Functions

Useful Report Functions Icon
Common Functions that you can use in Report Header or Footer Sections, while designing Reports, are given below. Copy and Paste the VB Code into a Global Module of your database and save it.
 

"Member Already Exists" Error when calling a public sub within a form

"Member Already Exists" Error when calling a public sub within a form Icon
I created a few Public Subs within a form earlier. I call them at the OnCurrent event in a tab control. I keep getting the following error whenever I change tabs. but when I remove the Call [sub] code, the error disappears.

Error:
"Member already exists in an object module from which this object module derives"
 

Opening a Form/Report with a large code Module

Opening a Form/Report with a large code Module Icon
And which Access must load each time it opens the form/report which could slow it down is it easier/smoother to put the codeinto a general module that Access will load at startup and keep loaded and call the procs from the form/report module reducing the amount of code in these modules and speeding up the openingof the form/report