HOW TO: Create a Function That Determines If Your Application Is Running in the Retail or Run-Time Version of Access 2000 (321106)



The information in this article applies to:

  • Microsoft Office 2000 Developer

This article was previously published under Q321106
For a Microsoft Office 97 Developer Edition version of this article, see 103182.

IN THIS TASK

SUMMARY

This article demonstrates how to use a function to determine if your Microsoft Access application is running in the run-time or the retail version of Microsoft Access. You can use this function to prevent your application from using the retail version of Microsoft Access.

back to the top

Code to Determine If Application Is in Run-Time

  1. Add the following function to a new or existing module in your application, and name it IsRuntime():
    Function IsRuntime ()
    
       On Error GoTo ErrIsRuntime
       IsRuntime = SysCmd(6)
    
    ByeIsRuntime:
       Exit Function
    
    ErrIsRuntime:
       If (Err = 5) Then
          IsRuntime = False
       Else
          Error Err
       End If
       Resume ByeIsRuntime
    End Function
    					
  2. Create the following macro and name it AutoExec:
       Macro Name   Condition         Action
       -------------------------------------
       AutoExec     Not IsRuntime()   MsgBox
                    ...               Quit
    
       AutoExec Action Arguments
       -------------------------------
       MsgBox
         Message: Invalid setup, run <YourAppName> setup and try again 
         Beep: Yes 
         Type: Critical 
         Title: <YourAppName>
    					
back to the top

Modification Type:MajorLast Reviewed:10/26/2002
Keywords:kbhowto kbHOWTOmaster KB321106 kbAudDeveloper