2017-05-13 3 views
0

ADMINSTRATOR TABLE에서 사용자 유형 필드를 조회하기 위해 작성한 코드에 대한 Microsoft 액세스에 문제가 있습니다. 구문 오류 3075 누락 된 표현으로 인해 실행할 수 없습니다. 연산자 'USER TYPE' 두 로그인 유형을 구별하여 다른 형식으로 가져 오는 데 사용되는 로그인 메뉴입니다.[Msoft Access] DLookup 용 코드 실행 중 오류가 발생했습니다.

Private Sub Command1_Click() 
    Dim UserLevel As Integer 

    If IsNull(Me.txtLoginID) Then 
     MsgBox "Please enter Login ID", vbInformation, "Login ID Required" 
     Me.txtLoginID.SetFocus 
    ElseIf IsNull(Me.txtPassword) Then 
     MsgBox "Please enter Password", vbInformation, "Password Required" 
     Me.txtPassword.SetFocus 
    Else 
    If (IsNull(DLookup("[User ID]", "ADMINSTRATOR TABLE", "[User ID]='" & Me.txtLoginID.Value & "' And Password = '" & Me.txtPassword.Value & "'"))) Then 
     MsgBox "Incorrect Password or Login ID", vbInformation, "Login unsuccessful" 
     Else 
     UserLevel = DLookup("USER TYPE", "ADMINSTRATOR TABLE", "USER ID = '" & Me.txtLoginID & "'") 
      DoCmd.Close 
      If UserLevel = 1 Then 
      MsgBox "Login Success", vbInformation, "Login Success" 
      DoCmd.OpenForm "MAIN MENU" 
      Else 
      MsgBox "Login Success", vbInformation, "Login Success" 
      DoCmd.OpenForm "ADMINISTRATOR FORM" 
    End If 
    End If 
    End If 
    End Sub 

답변

1

필드 이름과 공백이나 특수 문자 (가난한 디자인 선택)를 포함하는 테이블 이름이 필요 : 내 코드 나 사용자 보안 코드 여기

Dim UserLevel As Integer 
UserLevel = DLookup("USER TYPE", "ADMINSTRATOR TABLE", "USER ID = '" & Me.txtLoginID & "'") 

을 구현하기 전에

코드는 작동하다 대괄호로 둘러 쌓여있다.