Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2012
    Posts
    20

    Trouble with a selective query

    My main table includes all sorts of pertinent information on about 520 employees, while another table contains start dates, end dates, and the reason for an employee's expected absence. I am trying to run a query that returns personnel in a single work group (1 thru 8, entered as prompted when the query is run). When I set this up, it works swimmingly.

    When I try to add the Reason to my query, it returns only those entries which have an expected absence entered.

    I haven't even begun to try requesting this information for a specific date yet, as I anticipate that too will be a nightmare.

    Essentially, I would like to run a report that shows everyone in a work group on a given date and indicates whether or not they are available for work.

    Any help is greatly appreciated.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,631
    Show the attempted query SQL statement for analysis.

    Also helpful would be an example of source data.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    I'd be willing to bet you're using an inner join between the tables instead of an outer join. However, as June7 stated without seeing your SQL it's impossible to be definitive and correct.

  4. #4
    Join Date
    Nov 2012
    Posts
    20

    Re: Trouble with a selective query

    Quote Originally Posted by June7 View Post
    Show the attempted query SQL statement for analysis.

    Also helpful would be an example of source data.
    I'm not sure what that is, so here is the whole database:

    Duty Section.zip

  5. #5
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    As I expected Right click on the link between Duty Section and Excused Select Join properties and change the link between those 2 tables to a left outer join where all records from Duty Section and those matching records in Excused.

  6. #6
    Join Date
    Nov 2012
    Posts
    20

    Thanks

    Quote Originally Posted by RayMilhon View Post
    As I expected Right click on the link between Duty Section and Excused Select Join properties and change the link between those 2 tables to a left outer join where all records from Duty Section and those matching records in Excused.
    Thank you! That was it.

  7. #7
    Join Date
    Nov 2012
    Posts
    20
    Okay, now that I have that done, I can't seem to limit my query to a specific date. I'd like to be able to enter a date, and have the query return a "reason" only if there is an entry on the excused table for a period inclusive of that date. Ideally, if the query does return a reason I'd like the "Muster" box to be checked.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,631
    Try:

    criteria under [Begin Date]: <=[Enter date]

    criteria under [End Date]: >=[Enter date]
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    Nick, I want to make sure I understand what you're needing here. You are trying to run a query that shows all personnel available to work for a specific Date Range. If that is correct then what you want under the criteria for the 2 date fields is as follows

    Here's the criteria. ([Begin Date] is Null) or ([enter Date] Not between [begin Date] and [end date])

    In the critera section of the query builder under [Begin Date] put is null. Add another field to the query called [end date] in the criteria section under that field on a different row than the is null put "Not between [begin date] and [end date]"

    That should do it.

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

Similar Threads

  1. Selective Data Entry in access 2010 Forms
    By Fabricio Sanches in forum Forms
    Replies: 3
    Last Post: 02-22-2012, 12:16 PM
  2. E-mail Selective Report
    By adams.bria in forum Reports
    Replies: 1
    Last Post: 10-25-2011, 12:29 PM
  3. Combo box-Selective addition
    By reidn in forum Forms
    Replies: 1
    Last Post: 07-20-2011, 11:44 AM
  4. Selective Mean(s) question ...
    By efleming in forum Access
    Replies: 3
    Last Post: 05-25-2011, 02:06 PM
  5. Update Query- selective update?
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-29-2009, 11:15 AM

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