Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    12

    Field Level Date validation


    My application have been developed using MS Access forms with come VB code behind it...In one of the forms, I have two date fields,say,Date A and Date B.At any one given time,Date B must be greater than Date A,otherwise an error message(customized) should pop up requesting a valid input.This error should be envoked once the Date B field loose the focus......hence no more focus to other fields unless and until the valid date has been entered!!!!
    I have tried it using Validation Rule property at table and form level but it didnt work out properly...
    Any idea?

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275

    Re: Field Level Date validation

    Quote Originally Posted by fadone
    My application have been developed using MS Access forms with come VB code behind it...In one of the forms, I have two date fields,say,Date A and Date B.At any one given time,Date B must be greater than Date A,otherwise an error message(customized) should pop up requesting a valid input.This error should be envoked once the Date B field loose the focus......hence no more focus to other fields unless and until the valid date has been entered!!!!
    I have tried it using Validation Rule property at table and form level but it didnt work out properly...
    Any idea?
    I the form's BeforeUpdate event sub, add something like this:

    Code:
    If Me!DateA >= Me!DateB Then
        MsgBox "DateB must be greater than DateA", vbCritical, "Invalid Entry"
        Cancel = True
        Me.DateA.SetFocus
    End If

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Extra date field update
    By georgft in forum Forms
    Replies: 0
    Last Post: 09-17-2008, 06:51 AM
  2. Validation Rule: Date
    By krymer in forum Access
    Replies: 0
    Last Post: 08-27-2008, 03:30 PM
  3. Apply check at record level
    By wasim_sono in forum Programming
    Replies: 1
    Last Post: 04-19-2007, 07:48 AM
  4. date/time field
    By James890 in forum Database Design
    Replies: 1
    Last Post: 04-18-2007, 07:51 AM
  5. Validation rule for a text field
    By wasim_sono in forum Forms
    Replies: 4
    Last Post: 03-14-2006, 11:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums