Results 1 to 4 of 4
  1. #1
    Chuckp is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Posts
    10

    Need Combo Box to display value

    I've tried to simple this down from the larger project I'm working on - this little problem effects a few similar areas in the project so I simplified it.

    First table: tblEmployee which has fields of Employee_PK, FirstName, LastName, Active, Position and LDW which means last day worked.
    Second table: tblBoatTrip which has fields of Trip_PK, TripDate, Boat and Captain_FK

    The goal here is to be able to schedule say six boats a day and put a different captain on each boat but of course you can't have the same guy driving two boats on the same day.

    In the frmBoatTrip, I have a combo box so that you can pick a captain - it's rowsource is a query that grabs the Employee_PK, makes a fullname of that guys name, checks whether he's an active employee, checks whether he's a Captain and finally it compares the employee LDW with the tripdate from the frmBoatTrip - this gives me a list of guys that are not working that day and it works perfect

    So we have picked our guy, in the afterupdate of the combo box, I run an update query to change that guys LDW to the actual tripdate so when we try to schedule another boat for the same day, we can't pick him again - and again, this works perfect

    At this point, as long as the form stays open, you can move back and forth between records of boat trips and the selected captain name stays visible within the combo box - all appears just fine BUT if you close the form and reopen it and move back and forth between records, the captains name is gone - his primary key was stored in the tblBoatTrip but you can't see his name on the form.

    If you remove the date comparison from the combo box query, the name stays visible closing and reopening the form but that defeats the purpose of not wanting to select the same guy twice on the same day.

    I can certainly just store the captains name in a text box and have a seperate combo box where you select the captain da da da but I really don't want the extra field on the form, I'd just like the one field, pick what you want and move on, but I need to be able to see what the name is when I open and close the form. There's gotta be a way that this can be done but my brain has just turned to mush trying so many things - Please help!!



    I attached the simplified version here as a zip file, any help would be appreciated.
    Attached Files Attached Files

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Could you please see if that is what you want?

    Cheers,
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    Chuckp is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Posts
    10
    That works perfect - I had tried that in so many different ways but never on the "Enter" event - I limited in my experience and am trying to self learn. Sometimes it's really hard searching for answers because of the wording of your question. Thank you - I learned something very new to me!!

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    You're very welcome!

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 5
    Last Post: 05-31-2017, 08:58 AM
  2. Replies: 1
    Last Post: 02-06-2016, 05:33 AM
  3. Display value in combo box
    By jjmclell in forum Forms
    Replies: 4
    Last Post: 07-09-2015, 08:45 AM
  4. Combo box display
    By crowegreg in forum Forms
    Replies: 3
    Last Post: 07-13-2012, 12:24 PM
  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