• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 42
  • Last Modified:

How to set database System Options

Can I turn off System Option 'Use Access Special Keys' in VBA?

If so, I would appreciate a line of code.

Thanks in advance,

Clive Beaton
Clive Beaton
1 Solution
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
   currentdb.Properties("AllowSpecialKeys") = False 'turn off
   currentdb.Properties("AllowSpecialKeys") = True 'turn on

Open in new window

Clive BeatonAccess DeveloperAuthor Commented:
Thanks, Crystal.  You're  a wiz.

Pallavi GodseSr. Digital Marketing ExecutiveCommented:
What is the version of Microsoft Access you are using?

If you are using 2003 version then try the code below -
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
          Dim dbs As Database, prp As Property
          Const conPropNotFoundError = 3270
10        Set dbs = CurrentDb
20        On Error GoTo Change_Err
30        dbs.Properties(strPropName) = varPropValue
40        ChangeProperty = True
          Exit Function
          If Err = conPropNotFoundError Then  ' Property not found.
              Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)
              dbs.Properties.Append prp
              Resume Next
            Else        ' Unknown error.
              ChangeProperty = False
              Resume Change_Bye
          End If
End Function

Open in new window

and call -
ChangeProperty "AllowSpecialKeys", dbBoolean, False

Open in new window

To reverse it (turn them back on):
ChangeProperty "AllowSpecialKeys", dbBoolean, True

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now