Date field problem

Javelin

The Backpacker
Local time
Today, 17:18
Joined
Mar 14, 2003
Messages
12
Can someone please advise,

Basically I have created a risk database with one particular form collecting all the information of a user relating to a mitigation plan. On this form are two date fields - (1) Date Started - the date when the mitigation plan will begin (2) Date Complete - the date when the mitigation is expected to finish.

My problem is that the user can put a finish date into the Date Complete field which is earlier than what is entered into the Date Started field - How can I ensure that after the Date Started field had been filled in that the the Date complete is greater than the Date started field.

Also - How do I ensure that the user specifies a genuine date - i.e. 11/02/04 - instead of being able to put 11/22/44.

A big thankyou in advance.

Jav
 
In the Before Update event of the "EndDate" field...
Code:
Private Sub txtEndDate_BeforeUpdate(Cancel As Integer)
    
    If Me.txtStartDate > Me.txtEndDate Then
        MsgBox "The Expected finish Date Can't be earlier  than the Start Date"
        DoCmd.CancelEvent
    End If
    
End Sub
IMO
 
Thanks IMO that worked !!
 
Javelin said:

Also - How do I ensure that the user specifies a genuine date - i.e. 11/02/04 - instead of being able to put 11/22/44.
Sorry, forgot this bit, make sure you set the "Format" for each Date field to "Short Date" that way it's not possible to enter anything but a correct Date.

IMO
 
dates

you can also use a validation rule which will on let them enter a date such as 09/05/44 or even 09/05/1944 if you would like. Another cool feature is if you want to use the date of that exact day you can also use date()
 

Users who are viewing this thread

Back
Top Bottom