Results 1 to 2 of 2
  1. #1
    AimeeK Guest

    Make sure end date is one year greater than start date

    Hello, I am trying to create a form in which the user is required to enter a
    contract start date and a contract end date. An example of this is:

    [CONTRACT START DATE] 10/01/2005...Textbox control name is Text7
    [CONTRACT END DATE] 09/30/2006...Textbox control name is Text5

    How can I make sure that the user doesn't accidentally enter 09/30/2005?


    Please let me know which control to put the code in and which event to put it
    under. I'd prefer to use an If...Then statement to the tune of something
    like this:

    If Me.Text5<Me.Text7 Then
    msg = MsgBox("CONTRACT END DATE must be greater than the CONTRACT START
    DATE", vbCritical) = vbOk
    Me.Text5.SetFocus
    End If

    Any and all suggestions are most appreciated! Thanks in advance for your
    help.

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    Use the form's BeforeUpdate event, and be sure to set Cancel = True to prevent the update from occurring with the bad dates.

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

Similar Threads

  1. Changing a date to the current year
    By fdnyfish in forum Access
    Replies: 1
    Last Post: 03-01-2008, 08:34 AM
  2. Retrieving Week of Year in a date range
    By Korvega in forum Queries
    Replies: 2
    Last Post: 05-27-2006, 06:29 AM
  3. Finding data between two date for any year
    By gemini2 in forum Access
    Replies: 4
    Last Post: 04-05-2006, 06:20 AM
  4. Replies: 5
    Last Post: 02-08-2006, 08:42 PM
  5. Access Date/Time....I need a "generic" date.
    By beastmaster in forum Access
    Replies: 2
    Last Post: 12-29-2005, 12:55 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