004 MS Access VBA –Decision Making if then

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

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

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

004 MS Access VBA –Decision Making if then



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






    Option Compare Database

    Private Sub Command12_Click()
    Dim x As Integer
    Dim y As Integer
    Dim r As Integer
    x = Me.Text4.Value
    y = Me.Text6.Value
    r = x + y
    Me.Text8.Value = r

    End Sub

    Private Sub Command13_Click()
    Back Color = 65280
    End Sub

    Private Sub Command14_Click()
    MsgBox "This is a message box in VBA."
    End Sub

    Private Sub Command15_Click()
    Call Command14_Click
    End Sub
    Sub ShowMessage3(strMessage, strUserName)
    MsgBox strUserName & ", your message is: " & strMessage
    End Sub

    Private Sub Command16_Click()
    Call ShowMessage3("Keep on learning.", "John")
    End Sub
    Function addTwoNumbers()
    Dim num1 As Integer
    Dim num2 As Integer
    num1 = 3
    num2 = 2
    addTwoNumbers = num1 + num2
    End Function
    Private Sub Command17_Click()

    End Sub

    Private Sub Command18_Click()

    ' variable declaration
    Dim strFullName As String
    Dim dateOfBirth As Date
    Dim intAge As Integer
    Dim intmMo As Integer
    Dim intdy  As Integer
    ' assign values to variables
    strFullName = "John Smith"
    'dateOfBirth = #1/3/1967#
    dateOfBirth = Me.START_DATE.Value
    ' calculate age
    intAge = Year(Now()) - Year(dateOfBirth)
    'intmMo = Month(Now()) - Month(dateOfBirth)
    'intdy = Day(Now()) - Day(dateOfBirth)

    ' print results
    MsgBox (strFullName & " is " & intAge & " years old ")


    End Sub

    Private Sub Command2_Click()
    Dim stx As String
    stx = "hello here in vba "
     Text12.Value = " hello "
    Text0.Value = stx
    MsgBox ("Hello World ....")
    End Sub


    Private Sub Command22_Click()

    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

    Private Sub Command23_Click()
    Dim weeks As String
      On Error GoTo VeryEnd
    weeks = InputBox("How many weeks are in a year:", "Quiz")
    If weeks <> 52 Then MsgBox "Try Again" ' SimpleIfThen2
    If weeks = 52 Then MsgBox "Congratulations!"
    VeryEnd:

    End Sub




    شارك المقال

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


    إرسال تعليق

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