Wednesday, September 3, 2014

Code of vb (part-1)

Option Compare Database
Option Explicit


Private Sub Form_Open(Cancel As Integer)
    Me.Caption = Me.OpenArgs
End Sub
Private Sub Preview_Click()
    If IsNull([Beginning Date]) Or IsNull([Ending Date]) Then
        MsgBox "You must enter both beginning and ending dates."
        DoCmd.GoToControl "Beginning Date"
    Else
        If [Beginning Date] > [Ending Date] Then
            MsgBox "Ending date must be greater than Beginning date."
            DoCmd.GoToControl "Beginning Date"
        Else
            Me.Visible = False
        End If
    End If
End Sub

No comments:

Post a Comment