Roger's Access Library Homepage
Forum Home Forum Home > Other Download Libraries > MS Access MVP Libraries > Tejpal, A.D.
  New Posts New Posts RSS Feed - Reports_AddIn_2
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Please consider donating $1 per sample downloaded, (find out why here)


 Post Reply Post Reply
A.D. Tejpal View Drop Down
Microsoft MVP
Microsoft MVP

Joined: 30 Jun 2008
Status: Offline
Points: 192
Post Options Post Options   Thanks (0) Thanks(0)   Quote A.D. Tejpal Quote  Post ReplyReply Direct Link To This Post Topic: Reports_AddIn_2
    Posted: 17 Mar 2009 at 8:21pm

Sample Add-In - Explanatory Notes

    This Add-In is meant to utilize a set of common reports belonging to the Add-In, in various db's. Queries in host db are used as record source for such reports. On activation of the Add-In, names of reports belonging to the Add-In are shown in a list box at left, while names of queries available in host db are displayed in list box at right.

    For a given report selected in left list box, the user can select an appropriate query in right list box. The selected report will open, using selected query as its record source.

    Version:  Access 2000 File format

    Reference Required:  DAO 3.6

    The folder Reports_AddIn_2 should be put directly on the C: drive, so that the path for .mda file is -
C:\Reports_AddIn_2\Reports_AddIn_2.mda. (This is important, so as to establish the correct registry key)

    Open any database in Access and click on Tools > Add-Ins > Add-In Manager.
    Click on Add New. Browse to the folder and file at C:\Reports_AddIn_2\Reports_AddIn_2.mda
    Click OK. This will copy the .mda file to Microsoft's default Add-in folder for Access.
    You have to do this only once.

    To use Reports_AddIn from within any database, click Tools > Add-Ins > Reports_AddIn_2

    For a practical demonstration, import table TA_Books and queries QA_Books_1 to 3 from Add-In to host db. Rename the imported queries as desired, say Q_Books_1 to 3. Now, run the Add-In and open the report RA_Books (belonging to the Add-In) with different queries of host db (Q_Books_1 to 3, one by one) as its record source.

    Technical Notes:
    Certain factors having a bearing on use of  CodeProject / CodeDb are placed below, for ready reference:

    1 - For code contained in modules belonging to the AddIn:
        (a) If the AddIn is opened independently, CurrentProject / CurrentDb are identical to CodeProject / CodeDb respectively (all refer to AddIn itself).
        (b) If the AddIn is activated in host db, CurrentProject / CurrentDb refer to host db while CodeProject / CodeDb refer to AddIn itself.
        (c) Host applications AllForms / AllReports collections can be accessed by code in AddIn, using CurrentProject.
        (d) Tables / Queries are not covered by collections like those in prev para.
        (e) While the AddIn is in activated state, any query / table / form / report, whether in host db or in the AddIn, can be opened directly by name, using DoCmd statement in AddIn code, without having to use any special qualifier.
        (f) If any pair of similar objects exists both in the AddIn as well as the host db, code in AddIn module will act upon the object located in the AddIn itself.
        (g) For code in AddIn module, when the AddIn is in activated mode, queries / recordsets based upon CurrentDb do not recognize the tables in AddIn itself, unless referred via IN clause, giving full path of the AddIN. This path, returned by CodeProject.FullName, refers to the original location of AddIn mda file e.g. C:\REPORTS_ADDIN_2\REPORTS_ADDIN_2.MDA and not the shadow AddIn file in AddIns folder in MyDocuments.
        (h) For a report belonging to the Add-In, direct assignment of query name belonging to host db won't do. It will not be recognized. Objects in the Add-In can not be directly mixed those in the host db. The solution lies in using the IN clause with  full path of host db.
        (i) Run time assignment of record source in report's open event is found more dependable than doing so via an argument in DoCmd.OpenReport.

    2 - For code contained in modules belonging to the host db:
        (a) CurrentProject / CurrentDb are identical to CodeProject / CodeDb respectively, always referring to the host db, irrespective of the fact whether the AddIn is in activated state or not.
        (b) Whereas code in the AddIn can access all tables / queries / forms / reports, whether belonging to AddIn or the host db (see para 1 (e) above), code in host db can directly access only the objects belonging to host db itself.
    Download File >>:  uploads/37/


Back to Top
Sponsored Links

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.