Results 1 to 7 of 7
  1. #1
    Jackie is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    15

    lookup query and display in combo box?

    Hi All



    I was looking for a little help with one of my forms which assigns an engineer to a job using a combo box which works fine - what I'm looking for it to do is to when you select a date I want it to lookup a query which list all the days and engineer has booked off and if any engineers are booked off for that date I would like when you look at the combo box the engineers that are not available to turn a different colour and can not be selected

    I have had a look through the forum and on google but can't see anything that looks like this - I would really appricate if someone could point me in the right direction

    cheers jackie

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I don't know of a way to change colors within a combo box, but you could exclude the engineers that are not available from even showing up in the combo box by using a query for the combo box that excludes those engineers that are already booked.

  3. #3
    Jackie is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    15
    Hi there

    Thanks for the reply - that would be ok how would this work? I have a query that shows what staff and what date they are off but how would I build a query to show when they are available?

    Jackie

  4. #4
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You would most likely need a subquery

    SELECT engineerID, engineername
    FROM tableofengineers
    WHERE engineerID NOT IN (select engineerID from tableofdaysoff where dateoff= forms!formname!datecontrol)

  5. #5
    Jackie is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    15
    Hi

    OK this is what I have

    SELECT 0 as JobID, "<all>" as Initials FROM NullTable UNION ALL SELECT Staff.StaffID, Staff.Initials FROM Staff
    ORDER BY Initials WHERE StaffID NOT IN (SELECT StaffID FROM StaffHolidays WHERE HolDate = forms!SearchJobSheet!BookedDate);

    Syntax Error (Missing Operator) in query expression

    Not sure where I am going wrong? any ideas

    Jackie

  6. #6
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I would probably create the query with the subquery and save that, then reference the saved query in the union query.

  7. #7
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I had a thought, why would you include the option for ALL in the combo box if your intent was to limit it to only those who were available. There appears to be a logical issue there.

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

Similar Threads

  1. Month/Year lookup for combo box
    By Buakaw in forum Forms
    Replies: 7
    Last Post: 03-01-2011, 09:49 PM
  2. Combo Lookup
    By b123 in forum Forms
    Replies: 1
    Last Post: 02-24-2011, 11:24 AM
  3. Combo box lookup confusion
    By redpenner in forum Forms
    Replies: 5
    Last Post: 08-19-2010, 08:45 PM
  4. Recursive Lookup and display?
    By madyson in forum Access
    Replies: 3
    Last Post: 12-15-2009, 09:01 AM
  5. Combo Box Display
    By ssaucedo in forum Reports
    Replies: 17
    Last Post: 08-10-2009, 05:52 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