Results 1 to 2 of 2
  1. #1
    mrwelcam is offline Novice
    Windows XP Access 2007
    Join Date
    May 2009
    Posts
    1

    Date Comparrison

    Hi, I have a table with the fields Starting_Date and Finishing_Date. I need to create a query that asks the user to input a date and if the date is in between the Starting_Date and Finishing_Date the necessary rows will be displayed.

    This is what I have so far, but it doesn't work.

    SELECT PATIENT.[First Name], PATIENT.[Last Name], PATIENT_ADMISSION.Starting_Admission_Date, PATIENT_ADMISSION.Finsihing_Admission_Date


    FROM PATIENT INNER JOIN PATIENT_ADMISSION ON PATIENT.Patient_ID = PATIENT_ADMISSION.Patient_ID
    WHERE (((PATIENT_ADMISSION.Starting_Admission_Date)>=[Please enter a date]) AND ((PATIENT_ADMISSION.Finsihing_Admission_Date)<=[Please enter a date]));

    How do I make the [Please enter a date] value be used as a comparison for the two fields.

    Cheers

    Cam

  2. #2
    thhui is offline Competent Performer
    Windows XP Access 2002 (version 10.0)
    Join Date
    Feb 2009
    Posts
    235
    The sign of comparision according to the logic is wrong.

    The code should be:-
    Code:
    SELECT PATIENT.[First Name], PATIENT.[Last Name], PATIENT_ADMISSION.Starting_Admission_Date, PATIENT_ADMISSION.Finsihing_Admission_Date
    FROM PATIENT INNER JOIN PATIENT_ADMISSION ON PATIENT.Patient_ID = PATIENT_ADMISSION.Patient_ID
    WHERE (((PATIENT_ADMISSION.Starting_Admission_Date)<=[Enter Date]) AND ((PATIENT_ADMISSION.Finsihing_Admission_Date)>=[Enter Date]));

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

Similar Threads

  1. Top Date per Date in another table
    By danneedham in forum Queries
    Replies: 1
    Last Post: 05-28-2008, 05:47 PM
  2. Access Date/Time....I need a "generic" date.
    By beastmaster in forum Access
    Replies: 2
    Last Post: 12-29-2005, 12:55 PM
  3. Replies: 1
    Last Post: 12-09-2005, 10:29 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