Specifyinf conditions when selecting a date using calander

  • Thread starter Thread starter satty via AccessMonster.com
  • Start date Start date
S

satty via AccessMonster.com

Hi

Hope this doesnt sound like a dumb question -

I have cmboStartDate and cmboEndDate. Both use the same calander to select
their dates. I was hoping to put in a code to say that the cmboEndDate can
not be a lower date than cmboStartDate but i'm not sure where to type it -
AfterUpdate?
 
In the Before Update event of cmboEndDate:
If Me.cmboEndDate < Me.cmboStartDate Then
MsgBox "End Date must be After Start Date"
Cancel = True
End If
 
Thanks for your suggestion however it doesnt seem to work!

I've tried everything in both AfterUpdate and BeforeUpdate - it just doesnt
seem to recognise it becasue nothing is coming up. I'm able to select a date
from a calander which populates cmbStartDate and then using the same calender,
select another date which is stored in cmbEndDate. It doesnt call the
function to stop the two values being stored if the Start date is before the
end date chosen!! it's driving me mad!
 
I think I see the problem. You are using a calendar control to populate the
date fields. The Before and After Update events only fire if the data is
entered manually. They do not fire if updated programmatically.
Move the code to the Form's Before Update event. The After Update event is
too late.
 
Back
Top