PC Review


Reply
Thread Tools Rate Thread

calendar control+before update+HELP

 
 
Ivan Palčić
Guest
Posts: n/a
 
      19th Jun 2004
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




 
Reply With Quote
 
 
 
 
Michael.Keating
Guest
Posts: n/a
 
      20th Jun 2004
Hi,

You seem to be checking the end date value when that textbox gets the focus
but the user hasn't put any information in there yet.

Try changing the calendar click event to test the end date, something like:

Private Sub Calendar9_Click()

If (coordinator IS EndDate) And (Calendar9.Value <= StartDate) Then

Msgbox "Error Message"
Exit Sub
End If

coordinator.Value = Calendar9.Value

coordinator.SetFocus

Calendar9.Visible = False

Set coordinator = Nothing
End Sub

HTH

MFK.


"Ivan Palčić" <(E-Mail Removed)> wrote in message
news:cb1ddq$dc2$(E-Mail Removed)...
> 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
>
>
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2003 Calendar Control 11.0 value update David G. Microsoft Access 2 24th Jun 2010 01:11 AM
Re: After Update with Calendar Control? Allen Browne Microsoft Access Forms 0 20th Jan 2007 05:29 AM
Update Subform Based on Calendar Control =?Utf-8?B?RGF2ZSBD?= Microsoft Access Forms 1 23rd Nov 2006 12:52 PM
Update Calendar Control =?Utf-8?B?bWFjcm9wbGF5?= Microsoft Excel Programming 1 30th Jul 2006 06:01 PM
How do I update calendar control 8.0 to 10.0 Eric Microsoft Excel Programming 8 2nd Feb 2004 03:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:58 PM.