I
Ivan Palèiæ
Hi,
I have a little problem with the code below. I want that i can't input
EndDate that is before StartDate by clicking it on the CalendarControl, but
it doesn't work. I tried everything. Help me out, please!
Thanks in advance
_______________________________________
Option Compare Database
Option Explicit
Dim coordinator As ComboBox
Private Sub Calendar9_Click()
coordinator.Value = Calendar9.Value
coordinator.SetFocus
Calendar9.Visible = False
Set coordinator = Nothing
End Sub
Private Sub StartDate_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Set coordinator = StartDate
Calendar9.Visible = True
Calendar9.SetFocus
If Not IsNull(coordinator) Then
Calendar9.Value = coordinator.Value
Else
Calendar9.Value = Date
End If
End Sub
Private Sub EndDate_GotFocus(Cancel As Integer)
If EndDate < StartDate Then
Cancel = True
MsgBox "EndDate can't be before StartDate", vbCritical + vbOKOnly,
"Warning!"
End If
If EndDate = StartDate Then
Cancel = True
MsgBox "Guest didn't sleep over the night!", vbCritical + vbOKOnly,
"Warning!"
End If
End Sub
Private Sub EndDate_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Set coordinator = EndDate
Calendar9.Visible = True
Calendar9.SetFocus
If Not IsNull(coordinator) Then
Calendar9.Value = coordinator.Value
Else
Calendar9.Value = Date
End If
End Sub
I have a little problem with the code below. I want that i can't input
EndDate that is before StartDate by clicking it on the CalendarControl, but
it doesn't work. I tried everything. Help me out, please!
Thanks in advance
_______________________________________
Option Compare Database
Option Explicit
Dim coordinator As ComboBox
Private Sub Calendar9_Click()
coordinator.Value = Calendar9.Value
coordinator.SetFocus
Calendar9.Visible = False
Set coordinator = Nothing
End Sub
Private Sub StartDate_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Set coordinator = StartDate
Calendar9.Visible = True
Calendar9.SetFocus
If Not IsNull(coordinator) Then
Calendar9.Value = coordinator.Value
Else
Calendar9.Value = Date
End If
End Sub
Private Sub EndDate_GotFocus(Cancel As Integer)
If EndDate < StartDate Then
Cancel = True
MsgBox "EndDate can't be before StartDate", vbCritical + vbOKOnly,
"Warning!"
End If
If EndDate = StartDate Then
Cancel = True
MsgBox "Guest didn't sleep over the night!", vbCritical + vbOKOnly,
"Warning!"
End If
End Sub
Private Sub EndDate_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Set coordinator = EndDate
Calendar9.Visible = True
Calendar9.SetFocus
If Not IsNull(coordinator) Then
Calendar9.Value = coordinator.Value
Else
Calendar9.Value = Date
End If
End Sub