ACC1x: Run-Time Error Occurs Calling Financial Functions

ID: Q106246


The information in this article applies to:


SYMPTOMS

When you are calling financial functions, the following error message occurs:

A run-time error occurred in database: UTILITY. You don't have permissions to view modules in this database.


CAUSE

Although each function defined in the library has error trapping enabled, the declaration for the SetUserError() subroutine does not point to the correct dynamic link library (DLL).


RESOLUTION

You must change the UTILITY.MDA file using the procedure listed below. This change will correct the declaration for the SetUserError() subroutine, causing it to point to the correct DLL.


STATUS

This problem no longer occurs in Microsoft Access version 2.0.


MORE INFORMATION

Steps to Reproduce Problem

In any module's Immediate window, run the following function by typing:

? Rate(27,5495,277512,189000,1,0.1)

You will receive the error message stated in the SYMPTOMS section.

Steps to Correct Problem


  1. From the File menu, choose New Database to create a new, empty database. Type "junk.mdb" (without the quotation marks) in the File Name text box and choose OK.


  2. Close all instances of Microsoft Access.


  3. Open the MSACCESS.INI file located in the Windows directory using any text editor. (For example, use the Microsoft Windows Notepad text editor.)


  4. In the MSACCESS.INI file, locate the [OPTIONS] section. Comment out the UtilityDB line by placing a semicolon (;) at the beginning of the line.


  5. Add a new line to specify a new utility database called JUNK.MDB. The MSACCESS.INI file should now look like the following:

    NOTE: The drive and pathnames in your MSACCESS.INI file may differ from those listed in the example below.
    
           [Options]
           ;UtilityDB=D:\ACCESS.110\UTILITY.MDA
           UtilityDB=D:\ACCESS.110\JUNK.MDB 


  6. Save the changes to the MSACCESS.INI file and close the text editor.


  7. Open Microsoft Access.


  8. From the File menu, choose Open Database. Type utility.mda in the File Name text box and choose OK.


  9. You may receive error messages. Bypass these messages and continue.


  10. Open the Finance module.


  11. Change the following line
    
        Declare Sub SetUserError Lib "MSABC100.DLL" (ByVal ErrCode As _
                       Integer)
    
        to:
    
        Declare Sub SetUserError Lib "MSABC110.DLL" (ByVal ErrCode As _
                       Integer) 

    NOTE: In the declaration above, the underscore (_) is used as a line-continuation character to improve readability. Your code will appear on a single line without the underscore.


  12. Save the changes to the Finance module. Close Microsoft Access.


  13. Return the MSACCESS.INI file back to its original settings. The file should read:

    NOTE: The drive and pathnames in your MSACCESS.INI file may differ from those listed in the example below.
    
           [Options]
           UtilityDB=D:\ACCESS.110\UTILITY.MDA 


  14. Save the changes to the MSACCESS.INI file and close the text editor.



Keywords          : kberrmsg kbprg MdlLib 
Version           : 1.1
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: March 27, 1999