call functions in another module
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.
Thank you for taking the time to report an issue.
What's wrong... Please write below.
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.
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
Also, what does it matter if you enclose a sub or functions parameters with parenthesis
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
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
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
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?
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?