Results 1 to 5 of 5
  1. #1
    wlanssens is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    10

    Filtering out data for combobox

    Hi,

    I'm having a hard time getting the following to work, hopely you guys can help me out..

    I'll start with explaining what my goal is.. I have a table with workorders, it has a column "date planned" so I can give all the work orders a date when to be executed.


    On the other hand I also have a table with the ID of every technician and the dates when their vacation starts and ends, so 3 columns, 1 text, 2 dates.

    To link the 2 I use a table "schedule" where I have 4 columns, "ID", "WO", "TechID". WO refers to the workorder nummer that can be found in the schedule table.

    My end goal is to have a form with a subform "schedule" where I can see all the workorders in dataview, when I select a workorder in the table I want to fill up a combobox with all the technicians available, so that means that all the ones on vaction on the planned date of that WO are not included in the combobox..

    I tryed making a select query, but I have no clue how to make a "select ... where (date) is not between ... and ..."

    thanks!
    Lanssens

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    This will probably be a bit tricky. A nested subquery might be needed, something like:

    SELECT TechID, TechName FROM Technicians WHERE TechID Not IN (SELECT TechID FROM Vacation WHERE Forms!formname.WODate BETWEEN [VacStart] AND [VacEnd]);
    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
    wlanssens is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    10
    June7, thanks for the reply!
    So I make 1 query, where I select the techID's from Vacation between VacStart and VacEnd.. Does VacStart and VacEnd stand for the column names in table vacation?
    and then I make another query and insert the first query I made?

    Sorry I'm a bit of a novice..

    thanks!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Yes, use your actual field names.

    You can go to SQL View of query builder try copy/paste with appropriate edits of the suggested query then switch to Design View to examine that structure then see if it runs in Datasheet View.

    I find that the NOT operator will work but it is really slow.
    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.

  5. #5
    wlanssens is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    10
    Thanks June7! Works great!

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

Similar Threads

  1. Combobox Filtering in Form
    By dgwynn in forum Forms
    Replies: 6
    Last Post: 09-27-2012, 08:15 PM
  2. Replies: 1
    Last Post: 01-08-2012, 06:25 PM
  3. filtering data for reports
    By mejia.j88 in forum Reports
    Replies: 7
    Last Post: 12-27-2011, 12:19 PM
  4. Data filtering on a form
    By Sam4 in forum Forms
    Replies: 3
    Last Post: 11-23-2011, 05:14 PM
  5. Filtering data
    By billybong in forum Access
    Replies: 1
    Last Post: 11-07-2009, 12:20 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