-->
جاري التحميل ...

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

-1-
-2-



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."
ElseIf txtPwd = "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 محتوى كورس الاكسيس
مسلسل اسم الملف المدة ب الدقيقة لينك
1 001 MS Access VBA Grouping Code , Variables And Data Types 18 https://youtu.be/iT1bFbliG5E
2 002 MS Access VBA – Writing First Code 2 programs in one form 16 https://youtu.be/h-jXH_kcE4c
3 003 MS Access VBA – Writing First 2 programs 14 https://youtu.be/Z36lpESNk8k
4 004 MS Access VBA –Decision Making if then 24 https://youtu.be/phtKVh-QQ9w
5 005 MS Access VBA –Decision Making if then elsif nested if 16 https://youtu.be/IRYnGtcoJKo
6 006 MS Access VBA –Decision Making Select Case 20 https://youtu.be/32OckF0Zv6I
110 قائمة ملفات تعلم اكسيس المستوى الاول MS Access 380 min
https://www.youtube.com/playlist?list=PLMmy9Ec9B98wxI2RWVrjjtyV2knTFoR1t



-3-
-4-

التعليقات



إذا أعجبك محتوى مدونتنا نتمنى البقاء على تواصل دائم ، فقط قم بإدخال بريدك الإلكتروني للإشتراك في بريد المدونة السريع ليصلك جديد المدونة أولاً بأول ، كما يمكنك إرسال رساله بالضغط على الزر المجاور ...

إتصل بنا

جميع الحقوق محفوظة

مدونة كورس 7

2021