473,385 Members | 1,320 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,385 software developers and data experts.

Passing data between 2 seperate projects

16
I have built a quote engine for the rating of insurance premiums. Each month the rates that generate the premiums change which requires a new database file be created with updated premium tables (we need to keep the old ones so we can quote premiums for different months rates). I use the following dynamic reference to access the relevant rating file dependant upon the user's selection:

Access.References.AddFromFile "G:\UW Manual\Generic Testpack\Rates\" & strYear & "\" & strMonth & "\" & strProductName & ".mdb"

This works fine and I am able to call a sub in the rating file named "PrivateCarRatesGen". What I need to do is have this procedure populate containers / arrays / vars within the original project file.

Any ideas how I would go about this?




A couple of ideas I've been thinking about:

1. Remove the dynamic reference and simply open the file:

Dim RatesApp As Access.Application
Set RatesApp = New Access.Application
RatesApp.OpenAccessProject ("G:\UW Manual\Generic Testpack\Rates\2009\March\Trade-Marque+.mdb")
RatesApp.Run("PrivateVarRatesGen")

But how would the sub return values to the original project?

2. Write data to a text file / table. This would be functional but I am loathed to go about it this way.


To clarify: 2 project files. The 1st calls a sub in the 2nd. The 2nd needs to populate vars / containers and use classes in the 1st.
Feb 24 '09 #1
7 3003
FishVal
2,653 Expert 2GB
There was something you could use at the end of this thread.
Feb 24 '09 #2
Nates
16
How would I access a container in the calling mdb from the child mdb? Something like:

appParentApp.Modules("ModuleNameHere").ContainerNa meHere ?

One other question; can I not create a class rather than a form to pass the parent mdb through? Using a reference to create an instance of the class in the child mdb like the following:

Application.References.AddFromFile "C:\MyPath\MyChildMDBHere"
Dim AppChild as New ConnectionClass
AppChild.ParentApp = CurrentProject.Application?

This brings a debug due to incorrect use of the New keyword which seems odd (I set the class to Public in the child mdb and have established the reference prior to creating the instance of the class in the parent).

Thanks for your help thus far :)
Feb 25 '09 #3
FishVal
2,653 Expert 2GB
@Nates
It should work if Modules("ModuleNameHere").ContainerNameHere returns ContainerNameHere object in parent application.

One other question; can I not create a class rather than a form to pass the parent mdb through?
I think it is possible. You will need to instantiate this object of this class as global variable.

Using a reference to create an instance of the class in the child mdb like the following:

Application.References.AddFromFile "C:\MyPath\MyChildMDBHere"
Dim AppChild as New ConnectionClass
AppChild.ParentApp = CurrentProject.Application?

This brings a debug due to incorrect use of the New keyword which seems odd (I set the class to Public in the child mdb and have established the reference prior to creating the instance of the class in the parent).

Thanks for your help thus far :)
Since AppChild is being instantiated in parent mdb I don't see how it could be used in child mdb.
As for error with "New". Did you try to instantiate it this way in child mdb?
Feb 25 '09 #4
Nates
16
Not sure I can make use of the solution you linked.

I need to do the following:

1. Midway through a sub in project 1 a call is made to a sub in project 2
2. The called sub in project 2 generates endorsements / excesses / premiums using a class in project 1 (not through creating a new instance of said class, rather using the one already active within project 1).
3. Project 2 returns the generated endorsements / excesses / premiums to containers / vars in project 1.
4. Project 1 resumes on the next line of the sub after the call to project 2.

Effectively I need the sub within project 2 to behave as if it was a sub within a module in project 1.

Does VBA support C style includes perhaps?
Feb 25 '09 #5
FishVal
2,653 Expert 2GB
@Nates
Is the sub in project 2 needed to be executed in context of project 2 ? E.g. it uses data stored in project 2 to generate output.
Feb 25 '09 #6
Nates
16
The sub in project 2 needs to make use of data within both project 1 and 2 to return data to project 1.
Feb 26 '09 #7
FishVal
2,653 Expert 2GB
Well.

Here is a simple example.
Attached Files
File Type: zip 2 projects interaction.zip (35.7 KB, 182 views)
Feb 26 '09 #8

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

Similar topics

8
by: Alex Vinokur | last post by:
Various forms of argument passing ================================= C/C++ Performance Tests ======================= Using C/C++ Program Perfometer...
1
by: Rob Oliver | last post by:
Hi, I've seen a walkthrough for passing data from a setup project to a custom action (an application) with an InstallClass. I am curious though--can the data also be intercepted by a custom...
16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
6
by: Michael | last post by:
Hi all, I'm a Bachelor in Computer Engineering, and going to study Masters (major in Knowledge-Based systems). I'm quite fascinated by the concept of data-mining and knowledge-based systems, and...
5
by: Aku | last post by:
Hi, I have a solution with two projects in it. ProjectA has data which is needed in ProjectB. How do I pass this data to ProjectB? Thank you! *** Sent via Devdex http://www.devdex.com ***...
2
by: Eric | last post by:
I have a header server(.ascx) control that I want to use with all my existing seperate web apps. These web apps are configured as seperate web apps in IIS but when I try to build my solutiuon...
2
by: Roy | last post by:
Hey all, Is it possible to pass session variables between pages in separate projects? For example: inetpub\thisproject\blah.aspx has a session variable and response.redirects the user to...
13
by: Alan Silver | last post by:
Hello, MSDN (amongst other places) is full of helpful advice on ways to do data access, but they all seem geared to wards enterprise applications. Maybe I'm in a minority, but I don't have those...
1
by: SteveDouglas | last post by:
Hi all, I am currently writing an application in VB.NET that has a lot of controls (treeviews/listviews/labels and so forth) that represent "things" that need to be draggable from place to place,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.