Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dynamically load & execute VB function

Posted on 2003-10-28
7
Medium Priority
?
606 Views
Last Modified: 2012-08-14
Hello,

I'm using MS Access for fast multi-thread web pages download  from the internet and save parsed results into database or files

I would like to create sort of profiles for each job
I need a way to setup number of functions like Start_Download() and Finalize_Download() for each profile

and I want to display profiles in drop-down menu, so once user select some profile and click "GO" button I want my program to call functions (Start_Download() and Finalize_Download()) of selected profile
and I want this functions to have access to few global variables.

I have tried to use separate modules for each profile

I can do something like "call Module1.Start_Download(parameters)" but for some reason I can't use something like
 call Me.Application.Modules("Module1").Start_Download(parameters) (it said function is not found)
and also Eval("Module1.Start_Download(parameters)") is not working.

I don't mind to  use Classes instead of functions as long as I can select class by name (programmatically) - if someone can give me an example of how to use nested classes in different modules

any idea on how to accomplish this?

I could use One module and modify this module with different programs for each profile stored in databases (or modules) but i don't want to do it because it will be hard to control & save future program modifications in this approach.


Any help is appriciated
0
Comment
Question by:DRY_GIN
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 26

Expert Comment

by:Alan Warren
ID: 9640310
Hi DRY_GIN,

Is this an Access application or ASP?
Are you using the Access database just to store data or...?

Alan
0
 
LVL 3

Author Comment

by:DRY_GIN
ID: 9641123
it's microsoft Access Application

I figure out some way to implement this, the only problem is that it seems to me it that Module1.function and Module2.fuction can not co-exist if they have the same name, so for now instead of it i'm using
module1.fucntion_1 , module2.fucntion_2 ...

and I'm calling functions as

Application.Run "function_" & i ,  some parameters

it is working quite well, still it's not a perfect solution because i need to rename same functions for each new profile.

0
 
LVL 11

Expert Comment

by:joekendall
ID: 9641599
Are these functions in Access?

You can't have 2 functions named the same in Access. It doesn't accept Overloading so it doesn't know which function to call.

Why do you need to 2 different functions? Are they identical or are the different in some way? Can you post your code and maybe some changes could be made to make it work?

Joe
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Author Comment

by:DRY_GIN
ID: 9642399
I have a package (big set of functions, objects and tables) to do some job (web page download) with timers data processing ect.
now I want to use it for the different purposes.

for example I want to download 100000 pages from web site one -and parse whose pages into database - this require some additional coding.
tomorrow let's say I want to download 20000 images from web site 2 - so it will be another set of small additional functions to process with this images

I want to store all this "additions"  somehow inside my program for later usage.

Each of this jobs has it's own set of 6 small functions

OnStart
OnStop
PrepareNewDownload
FinishDownload
OnError
OnTimeOut
this 6 functions are not identical from job to job

in my main package I want to Call functions related to selected job (selected profile) during the process


So question was how to store pieces of Visual Basic code for different jobs inside one MS Access application (MDB file)

to have ability to use it later.

And later on if I select let's say job N10  I need some how to Use this 6 functions of Job 10 WITHOUT nasty Select cases like

Select JobID
 case 1:
   call onStart1
case 2
 call onStart2
....  <--- ugly


I don't know how else to explain

0
 
LVL 11

Accepted Solution

by:
joekendall earned 1000 total points
ID: 9642947
I believe you have 3 choices. You already know about 2 of them.

1 - Use the Select Case statements
2 - Make different functions for each JobID
3 - You can insert VB code into a module in Access. You can look up information in the help file about the Module Object.

Joe
0
 
LVL 3

Author Comment

by:DRY_GIN
ID: 9648978
I believe i already know about 3 of them.

" You can insert VB code into a module in Access" - did you read my question:
-"I could use One module and modify this module with different programs for each profile stored in databases (or modules) but i don't want to do it because it will be hard to control & save future program modifications in this approach
0
 
LVL 11

Expert Comment

by:joekendall
ID: 9649407
If I missed that part, I am sorry.

Since you already know 3 different ways to do it, I guess I can't be of any help. Maybe Alan has some insights.

Joe
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question