Topics Search

call functions in another module

call functions in another module
Views: 12
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.

Function in Report is repeating itself?

Function in Report is repeating itself? Icon
I call some functions from a report but this report seems to have an issue; It runs all functions in correct order, twice.

Is there anyone who can tell me why it is doing this and how I can prevent it?

The functions are public and are being called from a common module.

Where to define VBA Functions?

Where to define VBA Functions? Icon
Where do I define a user-defined VBA functions so that I can call them in the query?

Here is the problem. I am defining a VBA functions called DateDiffW which calculates the number of weekdays (i.e. excludes sat and sun) between 2 dates.

In access 2007, under the "create" tab I clicked "macro" -> "module". Then I defined the function there, starting with:

Function DateDiffW(BegDate, EndDate)

I then saved the module.

In the query, when I call the DateDiffW function I get the error:

"Undefined Function 'DateDiffW' in expression

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.

Calling Subs/Functions

Calling Subs/Functions Icon
What is the difference between using Call and not using call? I've seen before that it says 'expected equals' when running a sub without "Call", but a sub doesn't equal anything.

Also, what does it matter if you enclose a sub or functions parameters with parenthesis

Defining Global Variables

Defining Global Variables Icon
I want to define, not just declare, a global string array for use in all my subs and functions in my module.

I know how to define a global function, but I can not call this function in the same way I could call an array.

I could use a class, but I want all the code to be in the same standard module.

All I want to do is something like:

Global StringArray() As String

StringArray(1) = "First String"
StringArray(2) = "Second String"


And be able to access the members of the array elsewhere

VBA - Code structure

VBA - Code structure Icon
Im learning vb in order to be able to add some functionality to my db and forms.

I got experience from java and c and im trying to figure out how you structure and organize ur code in vba and what the similarities are.

When programming in e.g. java you have ur classes and methods where u add ur functions and whatever u wanna do. And then u have ur main function from where u call all the methods etc.

In VB, what ive understood, u got models and all these commands which been added to various buttons on forms reports etc.

Can these models be seen as the corresponding classes in java where u store all ur functions etc?

When looking in VB from some already made database u can see all the Class Objects where commands have been added to forms etc. In addition u also have ur modules below. How do these work together? When do I need a module?

If I have a form performing different tasks i.e a collection of class objects - why would I for example need a module

Creating Macro from Module

Creating Macro from Module Icon
to Rural Guy, I've been able to get the coding to copy one database to another.

Now that has been accomplished, I need to create a macro that calls to the module that I have created.

The module I've created that copys the table to another database is called Archive Current Server List.

I've been looking at the "RunCode" option but I have no idea how to call to the coding in the module to run it.

If I use the "Open Module" option, then it opens the module and you need to run the module from there.

I need to limit users from getting in this area as you know people could inadvertanly screw up the coding

How to call a query in my vba module

How to call a query in my vba module Icon
I have a query called "ClearTable Query" which clears the contents of a table, how do I call this in my vba module thingy? (i.e. the bit where you write the whole
sub myfunction
end sub

also, when I run the query on its own, it asks me for confirmation, how do I fix it so it just does the query without asking?

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?