Solved

Access accdbs and one MDA and same subroutine names

Posted on 2013-01-25
4
398 Views
Last Modified: 2013-01-27
Hi

I have two Access 2007 applications which are using a common set of subroutines and functions in an MDA. Now, one of the 2 Access apps needs a slight variation of one of the routines in the MDA. I was hoping I would have a kind of "function overloading" by defining, in that one Access app a slightly different version of the routine of the MDA but with the same routine name, and that, at run-time, Access would first look in the app itself before calling the routine in the MDA. But it doesn't. It ignores the version in the app, and runs the version in the MDA (and strange enough it doesn't complain about having 2 routines with the same name, one in the app, one in the MDA).

Is there anyway I can force Access to first look in the app and run that routine instead of the one in the MDA ? Or do I have to bite the bullet and have 2 different routine names and call the one I need specifically ?

I must add that the call to the routine is done from the MDA, so maybe that's why it doesn't look outside of the MDA ?

So, to be clear:

AppA and AppB both use a common MDA.
AppA calls a large routine R1 in MDA.
R1 calls a further routine R2 which is now existing in the MDA AND in AppA.
When AppA is calling R1 in the MDA, and R1 is calling R2, I'd like it to call AppA.R2 and and not MDA.R2

Wishful thinking ?

Thanks for help.
Bernard
0
Comment
Question by:bthouin
[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
4 Comments
 
LVL 58
ID: 38819111
<<Is there anyway I can force Access to first look in the app and run that routine instead of the one in the MDA ? >>

 Try a fully qualified reference, which is:

<VBA project name>.<procedure name>

 You can find your VBA project name under tools/properties in the VBA editor window.

Jim.
0
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 300 total points
ID: 38819123
<<When AppA is calling R1 in the MDA, and R1 is calling R2, I'd like it to call AppA.R2 and and not MDA.R2

Wishful thinking ?>>

 Think so.  The reference will need to be specific.  I can't think of anyway to call the procedure in the main DB from the lib only if it's there, which is what your thinking of in terms of overloading.

Jim.
0
 
LVL 58
ID: 38819133
<<But it doesn't. It ignores the version in the app, and runs the version in the MDA (and strange enough it doesn't complain about having 2 routines with the same name, one in the app, one in the MDA).>>

  Keep in mind that the VBA project names differ, so interally the fully qualified reference is not the same.

  What's weird is why it's not calling the one in the main project first; how are you calling the procedure?

Jim.
0
 
LVL 1

Author Comment

by:bthouin
ID: 38825842
Hi JDettman

Thanks for your multiple answers.

>>Try a fully qualified reference<<
I tried, but it didn't work, so I abandoned the idea, although my syntax (project name) might not have ben completely correct.

>> I can't think of anyway to call the procedure in the main DB from the lib only if it's there<<
OK, that's exactly what I wanted to know.

>>why it's not calling the one in the main project first<<
Probably because I'm calling the routine in the main DB from the Lib (mda)

>>how are you calling the procedure?<<
Just using its name: Call <procedure name>. It then of course finds that procedure in the Lib (as the call is in the Lib) and executes that.

I have now given up using fancy stuff, did 2 different procedures (stored in the Lib) for the 2 use cases, and call the one or the other depending on a flag which tells me which app is really calling the Lib. That's not ideal, but it of course works fine.

Thanks for your help.
Bernard
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

707 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