Applies ToAccess for Microsoft 365 Access 2024 Access 2021 Access 2019 Access 2016

This article provides reference information about the functions and properties that sandbox mode allows and blocks in Access. Note that Access allows several newer functions to run in sandbox mode, including MonthName and StrReverse, and it now blocks several more functions, including Assistance, ExportNavigationPane, and LoadCustomUI. As you proceed, remember that you must trust (enable the content in) the database or place the database in a trusted location for the information in this article to be of use.

In this article

Set sandbox mode to run unsafe expressions

When you add an expression to a database, Access runs that expression in an operating environment called sandbox mode. Access enables sandbox mode by default, and in turn, sandbox mode always disables unsafe expressions, even after you trust a database.

If you trust a database and you want to run an expression that sandbox mode disables, you can run that expression by changing a registry key that disables sandbox mode. Remember that you must first trust a database to follow the steps in this section.

This figure shows the process that you follow when deciding whether to run unsafe expressions.

The decision process for enabling or disabling sandbox mode

Caution      Incorrectly editing the registry may severely damage your operating system, requiring you to reinstall it. Microsoft cannot guarantee that problems resulting from editing the registry incorrectly can be resolved. Before editing the registry, back up any valuable data. For the most recent information about using and protecting your computer's registry, see Microsoft Windows Help.

If you are not familiar with the registry or you are not comfortable with changing registry keys yourself, contact someone who is or consider converting the database from the earlier version of Access to the Access file format. Also, you must have administrator permissions on the computer to change the registry values.

Change the registry key

Important: Following these steps allows unsafe expressions to run in all instances of Access for all users on the computer.

  • In Windows 10    

    1. On the taskbar, click Start, and then click Run.

    2. In the Open box, type regedit and then press ENTER.

      The Registry Editor starts.

    3. Expand the HKEY_LOCAL_MACHINE folder and navigate to the following registry key:

      \Software\Microsoft\Office\16.0\Access Connectivity Engine\Engines

      Note: Note, 16.0 indicates Access 2016 and newer versions.

    4. In the right pane of the registry editor, under Name, double-click SandboxMode.

      The Edit DWORD Value dialog box appears.

    5. In the Value Data field, change the value from 3 to 2, and then click OK.

    6. Close the Registry Editor.

Important    Remember that if you do not first trust the database, Access disables any unsafe expressions regardless of whether you change this registry setting.

You can set the registry value to the following values, with 0 (zero) being the most permissive and 3 being the least permissive.

Setting

Description

0

Sandbox mode is disabled at all times.

1

Sandbox mode is used for Access, but not for non-Access programs.

2

Sandbox mode is used for non-Access programs, but not for Access.

3

Sandbox mode is used at all times. This is the default value, set when you install Access.

Top of Page

Functions that you can use in sandbox mode

The following table lists the functions that you can use in Access database engine queries when sandbox mode is enabled. Any functions that do not appear in the list are not available in sandbox mode.

Abs

Array

Asc

Ascb

Ascw

Atn

CBool

CByte

CCur

CDate

CDbl

Choose

Chr

Chr$

Chrb

Chrb$

Chrw

Chrw$

Cint

Clng

Cos

Csng

Cstr

Cvar

CVDate

CVErr

Date

Date$

DateAdd

DateDiff

DatePart

DateSerial

DateValue

Day

DDB

Error

Error$

Exp

Fix

Format

Format$

FormatCurrency

FormatDateTime

FormatNumber

FormatPercent

FV

Hex

Hex$

Hour

IIf

IMEStatus

InStr

InStrb

Int

IPmt

IRR

IsDate

IsEmpty

IsError

IsNull

IsNumeric

IsObject

LCase

LCase$

Left

Left$

Leftb

Leftb$

Len

Lenb

Log

LTrim

LTrim$

Mid

Mid$

Midb

Midb$

Minute

MIRR

Month

MonthName

Now

NPer

Npm

Oct

Oct$

Partition

Pmt

PPmt

PV

QBColor Function

Rate

Replace

RGB

Right

Right$

RightB

Rightb$

Rnd

Round

RTrim

RTrim$

Second

Sgn

Sgr

Sin

SLN

Space

Space$

Str

Str$

StrComp

StrConv

String

String$

StrReverse

Switch

SYD

Tan

Time

Time$

Timer

TimeSerial

TimeValue

Trim

Trim$

TypeName

UCase

UCase$

Val

VarType

Weekday

Year

Top of Page

Functions that cause errors in sandbox mode

The following Visual Basic for Applications (VBA) functions will cause an error when the functions are called from an expression in an Access database engine query, or when called from an Access property.

AppActivate

Beep

Calendar

CallByName

ChDir

ChDrive

Command

Command$

CreateObject

CurDir

CurDir$

DeleteSetting

DoEvents

Environ

Environ$

EOF

Err

FileAttr

FileCopy

FileDateTime

FileLen

FreeFile

GetAllSettings

GetAttr

GetObject

GetSetting

Input

Input$

InputB

InputB$

Kill

Load

Loc

LOF

Randomize

Reset

SaveSetting

Seek

SendKeys

SetAttr

Shell

Spc

Tab

Unload

UserForms

Width

Top of Page

Functions blocked by sandbox mode

Sandbox mode blocks the following Access functions when the functions are called from an expression in a query or from an Access property. 

AddAutoCorrect

AddToFavorites

ADOConnectString

AnswerWizard

Application

Assistant

Assistance

AutoCorrect

AutomationSecurity

BeginUndoable

CloseCurrentDatabase

CodeContextObject

CodeDb

COMAddIns

CommandBars

CompactRepair

ConvertAccessProject

CreateAccessProject

CreateAdditionalData

CreateControl

CreateControlEx

CreateDataAccessPage

CreateForm

CreateGroupLevel

CreateNewWorkgroupFile

CreateReport

DataAccessPages

DBEngine

DDEExecute

DDEInitiate

DDEPoke

DDERequest

DDESend

DDETerminate DDETerminateAll

DefaultWebOptions

DefaultWorkspaceClone

DelAutoCorrect

DeleteControl

DeleteReportControl

DoCmd

Echo

ExportCustomFixedFormat*

ExportNavigationPane

ExportXML

FeatureInstall

FileDialog

FileSearch

FollowHyperlink

GetHiddenAttribute

ImportNavigationPane

ImportXML

InsertText

LanguageSettings

LoadCustomUI*

LoadFromText

LoadPicture

Modules

NewAccessProject

NewCurrentDatabase

NewFileTaskPane

OpenAccessProject

OpenCurrentDatabase

Parent

ProductCode

Quit

References

RefreshDatabaseWindow

RefreshTitleBar

ReloadAddIns

ReplaceModule

Run

RunCommand

SaveAsText

SetDefaultWorkGroupFile

SetHiddenAttribute

SetOption

SetUndoRecording

SysCmd

TransformXML

VBE

Top of Page

Properties blocked by sandbox mode

In addition to the functions listed in the previous section, sandbox mode also blocks a number of object properties. The following table lists the objects and the blocked property or properties for each object.

Object

Blocked Property or Properties

BoundObjectFrame

Object

Combobox

Recordset

Control

Object

CurrentProject

AccessConnection, BaseConnectionString, CloseConnection, Connection, OpenConnection

CustomControl

Object

Form

Dynaset

Hyperlink

Add to favorites

Listbox

Recordset

ObjectFrame

Object

Report

Recordset

SmartTagAction

Execute

Screen

ActiveDataAccessPage

Top of Page

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.