Page 1 of 3 123 LastLast
Results 1 to 15 of 44
  1. #1
    Brocco is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    23

    Access date Query

    Hi, i'm creating and Access project to do with bookings, resorts and sites. Each resort has a particular day in which it's booked for.



    What I want to do is create a query where it tells me what Resort is not booked at the present date. I have all the tables created and I think I need to enter something in the 'Criteria' section.

    I've looked everywhere for this and can't seem to find the solution. Swift reply would really be appreciated. Thanks, Dave

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    In the 'Criteria' row of the Booked Field of your query type in 'Is Null' [without ticks].
    This will give you all rows of data where there is nothing in the Booked field [resort is not booked].

    If you want a query that tells you what Resort is not booked for Today's Date:
    Type in 'Is Null' for Criteria under Booked and 'Date()' under criteria for your Date field.

    I hope this helps.

  3. #3
    Brocco is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    23
    Sorry about this but I prob didn't explain myself correctly.

    In my fields I have Resort name, Site name, plot number, Start date and End date. (The plot number is number of the plot on the site and the site is on the Resort)

    I need to run query which says which Resort isn't booked on todays date. (This in-turn would tell me which Plot number and Site is not booked?

    Sorry again.

  4. #4
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Does each Resort have more than one 'Site'?

    And does each Site have more than one 'Plot'?

    Is all the data in one Table?

    Can you give me a small example of what the data looks like for one Resort?
    Last edited by Robeen; 11-22-2011 at 11:40 AM. Reason: typo

  5. #5
    Brocco is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    23
    I took a screenshot of it, is there a way I can send it to you ?

  6. #6
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Post it here - it will be more helpful to anyone coming in later.

  7. #7
    Brocco is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    23
    Hope you can read this ?

  8. #8
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    What happens if you put 'Is Null' in the Criteria for Start Date in your query?

  9. #9
    Brocco is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    23
    Each column comes up blank

  10. #10
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    That is why I asked you:
    Can you give me a small example of what the data looks like for one Resort?
    If I see some actual [or fake] data - I might be able to better help you.

    Make up some data for resorts that HAVE bookings and some that do NOT have bookings so I can see what it looks like.

  11. #11
    Brocco is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    23
    This is my Booking Table. Maybe i've the wrong fields in the Query ?

    Each of my Resorts has only 1 booking, i've 10 Resorts

  12. #12
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    What you need is a query that returns:
    1. Every PlotID from tblPlot
    2. StartDate & EndDate [??] from tblBooking

    Then you want to put Is Null in the criteria for StartDate.
    This will show you all the Plots that have no bookings.

    Create a Query.
    Add tblPlot & tblBooking - in that order.
    Draw a Join between the Tables in Query Design on the PlotID.
    Dbl-Click the Join line & select Option 2 [Select all rows from tblPlot and only those . . .]
    Add PlotId from tblPlot & StartDate & EndDate from tblBooking to the results set.
    Under criteria for StartDate type Is Null.

    See if that works for you.

  13. #13
    Brocco is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    23
    When you say to Draw a join between the tables, what do I join to what ?

  14. #14
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    You will be joining the PlotID field in tblPlot to the PlotID field in tblBooking.

    Click & hold down on PlotID in tblPlot -> drag to PlotID in tblBooking.

    Hope this helps!

  15. #15
    Brocco is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    23
    When I do this I get an error: 'The SQL Statement could be executed because it contains ambiguous outer lines......'

    Oh my God............................

Page 1 of 3 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 04-26-2012, 04:01 AM
  2. query to update a date based on another date
    By tkendell in forum Access
    Replies: 3
    Last Post: 06-29-2011, 09:32 PM
  3. Using Date in Access
    By ricyac in forum Queries
    Replies: 1
    Last Post: 06-28-2011, 08:46 AM
  4. Replies: 2
    Last Post: 07-31-2009, 06:56 AM
  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