Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2006

    Unanswered: Need simple code to check before adding new records

    The problem is simple for the most of you:
    I have a table Trips(id[autoNumber], PersonID, date-from, date-until, country).
    Also I have created a form for the user to input data for every trip.

    But there is one restriction:
    For every record, the code must check if the person has been gone to more than one place. For example, if the person has gone to France between 14-19/2/2006 there cannot be a second trip for the same person to USA between 18-22/2/2006.

    Could someone help me with the code?
    Thank you very much.

  2. #2
    Join Date
    Sep 2003
    How do you want to do it? ADO DAO? The SQL is rather simple:

    SELECT * FROM SomeTable WHERE ((StartDate BETWEEN date-from AND date-until) OR (EndDate BETWEEN date-from AND date-until))

    This returns rows that INVALIDATES the date range given ...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts