By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,785 Members | 2,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,785 IT Pros & Developers. It's quick & easy.

field validation rule for access

P: 1
i have two fields PROJECT START DATE and PROJECT END DATE.
now i want to creat a validation rule so that the Project End Date will be greater than the Project Start Date.
Can any one please help me out i need this as soon as possible
Apr 30 '07 #1
Share this Question
Share on Google+
3 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
I am moving your question to the Access forum where you are more likely to get help.

Mary
Apr 30 '07 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
i have two fields PROJECT START DATE and PROJECT END DATE.
now i want to creat a validation rule so that the Project End Date will be greater than the Project Start Date.
Can any one please help me out i need this as soon as possible
In the validation Rule property of [Project End Date] put

Expand|Select|Wrap|Line Numbers
  1. >[Project Start Date]
Apr 30 '07 #3

pks00
Expert 100+
P: 280
I prefer the use of vba because u want to validate both start and end dates - thats if both are entered by the user.
Its possible for someone to enter a end date then a start date

eg

Expand|Select|Wrap|Line Numbers
  1.  private sub ProjectStartDate_BeforeUpdate(Cancel as integer)
  2.     Cancel = ValidateDate
  3. end sub
  4.  
  5. private sub ProjectEndDate_BeforeUpdate(Cancel as integer)
  6.     Cancel = ValidateDate
  7. end sub
  8.  
  9. private function ValidateDate as integer
  10.  
  11.     ValidateDate = false
  12.  
  13.     if isnull(Me.projectStartDate) = false and isnull(Me.projectenddate) = false then
  14.         if Me.projectStartDate > Me.projectEndDate then
  15.             msgbox "Invalid date"
  16.             ValidateDate = true
  17.         end if
  18.     end if
  19. end function
  20.  
Apr 30 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.