005 MS Access VBA –Decision Making if then elsif nested if

إشترك في النشرة البريدية

إغلاق القائمة
جميع الحقوق محفوظة لـ MS Access © 2019
إعلان الهيدر

الرئيسية / / 005 MS Access VBA –Decision Making if then elsif nested if

005 MS Access VBA –Decision Making if then elsif nested if



محتويات الموضوع





    If myNumber = 0           Then
                 MsgBox"You entered zero."
    ElseIf myNumber > 0   Then
         MsgBox "You entered a positive number."
    ElseIf myNumber < 0    Then
         MsgBox "You entered a negative number."
    End if
    \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    Private Sub cmdOK_Click()
    If txtPwd= "FOX" Then
                 MsgBox "You are not authorized to run this report."
    ElseIftxtPwd= "DOG" Then
    If txtUser = "John" Then
              MsgBox "You are logged on with restricted privileges."
    ElseIf txtUser = "Mark" Then
              MsgBox "Contact the Admin now."
    ElseIf txtUser = "Anne" Then
              MsgBox "Go home."
    Else
              MsgBox "Incorrect user name."
    End If
    Else
              MsgBox "Incorrect password or user name"
    End If
    Me.txtUser.SetFocus
    End Sub
    \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

    Sub TestButtons()
    Dim question As String
    Dim bts As Integer
    Dim myTitle As String
    Dim myButton As Integer
    question = "Do you want to preview the report now?"
    bts = vbYesNoCancel + vbQuestion + vbDefaultButton1
    myTitle = "Report"
    myButton = MsgBox(prompt:=question, buttons:=bts, Title:=myTitle)
    Select Case myButton
            Case 6
                  DoCmd.OpenReport"Sales by Year", acPreview
            Case 7
                  MsgBox"You can review the report later."
           Case Else
                    MsgBox"You pressed Cancel."
    End Select
    End Sub

    \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    Select Case myNumber
             Case Is <= 10
                  MsgBox"The number is less than or equal to 10."
             Case 11
                 MsgBox"You entered 11."
           Case Is >= 100
                MsgBox "The number is greater than or equal to   100."
           Case Else
                MsgBox "The number is between 12 and 99."
    End Select


    \\\\\\\\\\\\\\\\\\\\\\
    Select Case myButton
                  Case vbYes
                       DoCmd.OpenReport "Sales by Year", acPreview
                 Case vbNo
                      MsgBox"You can review the report later."
                Case Else
                      MsgBox"You pressed Cancel."


    End Select


    \\\\\\\\\\\\\\\\\\\\\

    Select Case myNumber
                    Case Is <= 10
                             MsgBox"The number is less than or equal to 10."
                   Case 11
                            MsgBox"You entered 11."
                  Case Is >= 100
                          MsgBox"The number is greater than or equal to 100."
                  Case Else
                          MsgBox"The number is between 12 and 99."
    End Select


    vba محتوى كورس الاكسيس
    مسلسلاسم الملفالمدة ب الدقيقةلينك
    1001 MS Access VBA Grouping Code , Variables And Data Types18https://youtu.be/iT1bFbliG5E
    2002 MS Access VBA – Writing First Code 2 programs in one form16https://youtu.be/h-jXH_kcE4c
    3003 MS Access VBA – Writing First 2 programs14https://youtu.be/Z36lpESNk8k
    4004 MS Access VBA –Decision Making if then24https://youtu.be/phtKVh-QQ9w
    5005 MS Access VBA –Decision Making if then elsif nested if16https://youtu.be/IRYnGtcoJKo
    6006 MS Access VBA –Decision Making Select Case20https://youtu.be/32OckF0Zv6I
    110 قائمة ملفات تعلم اكسيس المستوى الاول MS Access 380 min
    https://www.youtube.com/playlist?list=PLMmy9Ec9B98wxI2RWVrjjtyV2knTFoR1t






    شارك المقال

    DBD Badie Mousa Ragye
    @مرسلة بواسطة
    كاتب ومحرر في موقع MS Access .


    إرسال تعليق

    ضع اعلانك هنا
    اعلان اخر الموضوع