Private Sub Command1_Click() 
 If Trim(Text1.Text) = "" Then
    MsgBox "请输入密码"    
 ElseIf Trim(Text1.Text) = "123" Then
    Show 窗口2 
 Else: MsgBox "密码错误"
 End If  
 
 
End Sub

解决方案 »

  1.   

    if not len( text1.text ) then
      msgbox "必须输入密码"
    else if text1.text="123" then
       b.show
    else
       msgbox "密码不正确!请重新输入"
    end if
      

  2.   

    Private Sub Command1_Click() 
     If Trim(Text1.Text) = "" Then
        MsgBox "请输入密码"    
     ElseIf Trim(Text1.Text) = "123" Then
        b.show 
     Else: MsgBox "密码错误"
     End If  
    End Sub
      

  3.   

    Public blnLogin as booleanprivate sub form_load()
          blnlogin=false
    end sub
    if trim( text1.text )="" then
      msgbox "必须输入密码"
    else if text1.text="123" then
       blnlogin=true
       unload meelse
       msgbox "密码不正确!请重新输入"
    end ifPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
                if (not blnlogin)
                     cancel=true          '未登陆,不允许关闭窗口
                else
                      b.show 1
                end if
    End Sub
      

  4.   

    if trim(text1.text)="" then
        msgbox "请输入密码"
    else 
        if trim(text1.text)="123" then
            b.show 1
        else
            msgbox "密码不正确!请重新输入"
        end if
    end if
      

  5.   

    Private Sub Command1_Click() 
     If Trim(Text1.Text) = "" Then
        MsgBox "请输入密码!" 
        Exit Sub 
     End If  
    If Trim(Text1.Text) = "123" Then
        b.show 
    Else
        MsgBox "密码错误"
    End If  
    End Sub