Access 데이터베이스에서 시작 옵션을 적용하거나 사용하지 않도록 설정하는 방법

이 문서는 Microsoft Access 프로젝트(.adp)에만 적용됩니다.

보통: 기본 매크로, 코딩 및 상호 운용성 기술이 필요합니다.

요약

이 문서에서는 시작 옵션을 무시할 수 있도록 하는 SHIFT 키의 기능을 사용하지 않도록 설정하는 방법을 설명합니다. 이 문서에서는 Microsoft Access 데이터베이스 프로젝트에서 시작 옵션을 적용하는 방법도 설명합니다.

추가 정보

Access 파일에 대해 정의된 시작 옵션은 파일을 열 때 파일의 모양과 파일 동작 방식을 결정합니다. 시작 사용자 인터페이스를 사용하거나 AutoExec 매크로를 사용하여 시작 옵션을 설정할 수 있습니다.

Access 데이터베이스 프로젝트에 대해 설정된 시작 옵션을 무시하려면 Access 데이터베이스 프로젝트를 여는 동안 SHIFT 키를 누릅니다.

또는 Access 데이터베이스 프로젝트에 대해 설정된 시작 옵션을 적용하려면 시작 옵션을 무시할 수 있도록 하는 SHIFT 키의 기능을 사용하지 않도록 설정합니다. 이렇게 하려면 AllowBypassKey 속성을 False로 설정합니다.

AllowBypassKey 속성을 False로 설정하려면 다음 단계를 수행합니다.

Access 프로젝트(.adp)에 대한 단계

  1. 액세스를 시작합니다.

  2. Access 데이터베이스 프로젝트를 엽니다.

  3. Alt + F11 키를 눌러 Visual Basic 편집기를 엽니다.

  4. Visual Basic 편집기에서 보기 메뉴에서 직접 실행 창을 클릭합니다.

  5. 다음 코드를 입력하거나 직접 실행 창에 다음 코드를 붙여넣은 다음 Enter 키를 누릅니다.

    CurrentProject.Properties.Add "AllowBypassKey", False
    
  6. Visual Basic 편집기 닫은 다음 Access 데이터베이스 프로젝트를 닫습니다.

  7. Access 데이터베이스 프로젝트를 엽니다. Access 데이터베이스 프로젝트를 여는 동안 SHIFT 키를 누른 채 Access 데이터베이스 프로젝트에 대해 설정된 시작 옵션을 무시해 보세요.

    시작 옵션을 바이패스할 수 있는 SHIFT 키의 기능은 사용하지 않도록 설정됩니다. Shift 키를 눌러 시작 옵션을 무시하지만 시작 옵션이 실행됩니다. 시작 옵션을 무시할 수 없습니다.

Access 데이터베이스에 대한 단계(.mdb 또는 .accdb)

  1. 액세스를 시작합니다.

  2. 새 모듈을 만든 다음 다음 두 함수를 추가합니다.

    Function ap_DisableShift()
    'This function disable the shift at startup. This action causes
    'the Autoexec macro and Startup properties to always be executed.
    
    On Error GoTo errDisableShift
    
    Dim db As DAO.Database
    Dim prop as DAO.Property
    Const conPropNotFound = 3270
    
    Set db = CurrentDb()
    
    'This next line disables the shift key on startup.
    db.Properties("AllowByPassKey") = False
    
    'The function is successful.
    Exit Function
    
    errDisableShift:
    'The first part of this error routine creates the "AllowByPassKey
    'property if it does not exist.
    If Err = conPropNotFound Then
    Set prop = db.CreateProperty("AllowByPassKey", _
    dbBoolean, False)
    db.Properties.Append prop
    Resume Next
    Else
    MsgBox "Function 'ap_DisableShift' did not complete successfully."
    Exit Function
    End If
    
    End Function
    
    Function ap_EnableShift()
    'This function enables the SHIFT key at startup. This action causes
    'the Autoexec macro and the Startup properties to be bypassed
    'if the user holds down the SHIFT key when the user opens the database.
    
    On Error GoTo errEnableShift
    
    Dim db as DAO.Database
    Dim prop as DAO.Property
    Const conPropNotFound = 3270
    
    Set db = CurrentDb()
    
    'This next line of code disables the SHIFT key on startup.
    db.Properties("AllowByPassKey") = True
    
    'function successful
    Exit Function
    
    errEnableShift:
    'The first part of this error routine creates the "AllowByPassKey
    'property if it does not exist.
    If Err = conPropNotFound Then
    Set prop = db.CreateProperty("AllowByPassKey", _
    dbBoolean, True)
    db.Properties.Append prop
    Resume Next
    Else
    MsgBox "Function 'ap_DisableShift' did not complete successfully."
    Exit Function
    End If
    
    End Function
    
  3. Visual Basic 편집기에서 보기 메뉴에서 직접 실행 창을 클릭합니다.

  4. SHIFT 키를 사용하지 않도록 설정하려면 직접 실행 창에 ap_DisableShift 입력한 다음 Enter 키를 누릅니다. Shift 키를 사용하도록 설정하려면 직접 실행 창에 ap_EnableShift 입력한 다음 Enter 키를 누릅니다.