Allow MDB open from runtime only?

C

Cruzer

I recall some posted VB code that checked if the runtime or full
version of Access was being used to attempt to open an MDB at startup.
Depending on the result, the mdb was opened or closed. Does anyone
have this code or know where it can be found?
 
C

Cruzer

My search terms were too generic .... I was provided with the SysCmd
reference by a gracious poster on another forum. Here's a few
snippets I found using search "syscmd runtime" for those that could use
them:

---------------------------------------------------

If SysCmd(acSysCmdRuntime) = True Then
' Do stuff here if runtime
Else
' Do stuff here if full retail Access
End If

---------------------------------------------------

Function CheckRunTime()

If (CurrentUser() = "MyUserName") Then
Exit Function
End If

If SysCmd(SYSCMD_RUNTIME) = 0 Then
Beep
Msg = "You are trying to operate MyAppName with" & Chr$(13)
Msg = Msg & "a standard version of Microsoft Access." & Chr$(13)

Msg = Msg & "MyAppName will not operate properly in this" &
Chr$(13)
Msg = Msg & "environment." & Chr$(13) & Chr$(13)
Msg = Msg & "You will now be returned to the operating system."
& Chr$(13)
Message = MsgBox(Msg, 48 + 0, "ERROR: NOT RUNTIME ENVIRONMENT")
DoCmd Quit 'exits Access
End If

End Function
------------------------------------------

Function Runtime() as Boolean
Runtime = SysCmd(acSysCmdRuntime)
End Function

-------------------------------------------

If SysCmd(acSysCmdRuntime) = False Then
MsgBox "This application can only be run under the Runtime version
of Access.", MB_ICONSTOP
Application.Quit acQuitSaveAll
End If

-------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top