473,396 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

VBA to run multiple Public functions/Modules

DJRhino1175
221 128KB
I have 3 modules that I trigger individually with a command button to run the code. What I'm curious is there a way for me to run the 3 different modules one right after the other?
Currently there is 2 buttons that open up the same form but with different filtering and a third button that opens another form.

If needed I could add the code behind each button, but I'm hoping its not. It is lengthy.
Nov 28 '18 #1

✓ answered by Rabbit

In the code for the button, call the 3 other functions.
Expand|Select|Wrap|Line Numbers
  1. Sub ButtonName_Click()
  2.    Call FunctionNameA()
  3.    Call FunctionNameB()
  4.    Call FunctionNameC()
  5. End Sub
  6.  
The bigger issue you should be working on is why the code takes 3 days and 12 hours to run. Most likely something is running extremely inefficiently and if you fix the inefficiency, you can cut the run time down to minutes.

6 2255
twinnyfo
3,653 Expert Mod 2GB
DJ,

Your question is a bit confusing, as you talk about triggering modules. I think I understand what you mean there, but then you mention opening different forms.

One does not trigger modules, one triggers procedures within modules. As long as those procedures are public, they can be executed from anywhere at any time, in or out of sequence. Perhaps we need a bit of clarification on this one.

However, I think the general answer to your question is “yes”.

Hope this hepps.
Nov 28 '18 #2
DJRhino1175
221 128KB
That's good, When I'm back in front of the database I will post the code of each module. What I truly want to do is click a button and have it trigger function 1, and once this one is complete it will trigger function 2 and so one. Each one of these function exports several reports of a certain report that meet certain criteria.

I kind of goofed in my question. I have macros(I know the wrong way of doing) that open a filtered form. Then on that form I have a button that triggers the function to export reports that meet certain criteria. As it stands now everything works perfectly, I just have to do it individually and one of the function runs for 3 days straight, the other 2 can be done in less than 12 hrs.
Nov 28 '18 #3
Rabbit
12,516 Expert Mod 8TB
In the code for the button, call the 3 other functions.
Expand|Select|Wrap|Line Numbers
  1. Sub ButtonName_Click()
  2.    Call FunctionNameA()
  3.    Call FunctionNameB()
  4.    Call FunctionNameC()
  5. End Sub
  6.  
The bigger issue you should be working on is why the code takes 3 days and 12 hours to run. Most likely something is running extremely inefficiently and if you fix the inefficiency, you can cut the run time down to minutes.
Nov 28 '18 #4
DJRhino1175
221 128KB
Wow a lot easier than I thought. This is a very complex database created by another programmer and its been taking me a long time to chip away at it, but getting there. Some of the time is, there are thousands of reports to export out. I usually have it run on the weekends while i'm off of work.
Nov 28 '18 #5
NeoPa
32,556 Expert Mod 16PB
I'm just going to go ahead and mark Rabbit's post as the Best Answer. It perfectly answers the question posed.
Nov 28 '18 #6
Rabbit
12,516 Expert Mod 8TB
Feel free to create a new thread for this but figuring out the purpose of exporting thousands of reports and addressing that need in a different way help the run time tremendously. I suspect no one's actually looking at these thousands of exports and it's being used for a different purpose. Eliminating this export by serving the ultimate end goal in another way will be a huge time saver.
Nov 29 '18 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Daniel Pryde | last post by:
Hi there. I'm currently trying to learn Python, my aim being to create my final year project at university using only Python instead of Java. I've run into a problem though while trying to make...
6
by: Steven An | last post by:
Howdy, I need to write an update query with multiple aggregate functions. Here is an example: UPDATE t SET t.a = ( select avg(f.q) from dbo.foo f where f.p = t.y ), t.b = ( select sum(f.q)...
1
by: Andrew Poulos | last post by:
I having some trouble understanding how to make functions private I have created an instance of an object using a constructor function and there are 4 prototypes: Comm = function() { //blah...
3
by: Duane | last post by:
Can anyone tell me what is the standard practice for creating functions that can be used globally by a asp.net application. Should we put them in a class or just create another webform and...
3
by: Mat | last post by:
Hi, I am trying to create a set of global functions that are available to any page. However I am not really getting anywhere, even after looking at several examples. This is the code I have...
3
by: Mark P | last post by:
#include <iostream> using namespace std; struct Base { virtual int foo () {return 1;} virtual int foo (int i) {return 2;} virtual ~Base () {} };
5
by: John | last post by:
Hi Is there a way to declare public functions that can be accessed in any aspx page? Can global variables be declared? Thanks Regards
2
by: Calm_Pear | last post by:
Hi all, I have created an object with a default function; the default function exposes a public function as well. myobject = function(){
3
by: akaash19 | last post by:
I want to have one private key at server but multiple public keys for multiple clients. Can we generate multiple public keys for one private key?
14
by: molly00mayhem | last post by:
hi all um, lets see, im a 4th year elementary school teacher in a large urban area, msaccess novice, new to this forum, who has been helped greatly by the pros here. i took a break from reading...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.