Results 1 to 4 of 4
  1. #1
    tony30 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    13

    COMBO BOX showing more instances than the selected, in previous Combo

    I have this DB application that took me a couple of weeks, given my lack of experience, I t is basically a "booking" system with a number of residents that
    book a space in a garage, I got the DB working, I was even able to build a query where the clashes show (in a way of a subform) in the "Bookingform",However when I tried to do cascading boxes, where the user can choose an apartment number , the second combo box would populate WITH ONLY the residents of that apartment, however being unbound , they do not get saved in the "TblBookings" . ResidentName and ApartmentNumber fields are in table TblResident.
    Any special recomendations?
    The only way I can make it work is when the control sources for Combo box for ApartmentNumber and ResidentName are both selected to: ResidentID, and it shows a long list of ALL the residents, since they are ordered ascendent, they are next to each other and is fairly easy to Select the value , however, I want to make the application bulletproof and SHOW ONLY the residents that live in the apartment selected.


    Thank you in advance and I really appreciate the help received.
    tony30
    Please fell free to tweak and modify . I am sending both DBs.
    And please forgive my lack of experience.
    Attached Files Attached Files

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I'm looking at the database:

    Parking I3 forum.accdb

    I'm looking at the form:

    FrmBooking

    Do this:

    Change the APARTMENT NUMBER field (combo25) to an UNBOUND field (Delete the control source of ResidentID)
    Change the ROW SOURCE of the APARTMENT NUMBER field (combo25) to:
    Code:
    SELECT TblResident.ApartmentNumber
    FROM TblResident
    GROUP BY TblResident.ApartmentNumber;
    Change the ROW SOURCE of the RESIDENTID field to
    Code:
    SELECT TblResident.ResidentID, TblResident.ResidentName, TblResident.ApartmentNumber
    FROM TblResident
    WHERE (((TblResident.ApartmentNumber)=[forms]![frmBooking]![combo25]));
    In the AFTER UPDATE event of the APARTMENT NUMBER field (combo25) put this:

    Code:
    ResidentID.Requery
    When you select an apartment from the apartment list it will show you only the people related to that apartment.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,951
    Is a spot assigned to an apartment or to resident?

    This checking in and out of parking spot reminds of the Lending Library database template. Did you check it out?

    In your situation where the primary combobox value does not need to be saved, I think you will have to use unbound combobox to select apartment.

    If you use unbound combobox for resident then use code to save value. Regardless, use a textbox to display the resident by joining TblResident to the form RecordSouce, join type 'Include all records from TblBooking'. Set the textbox as Locked Yes, TabStop No.
    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.

  4. #4
    tony30 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    13
    IT Works wonderfully, Thank you so much!!!!
    Changing The recordsource did the trick, Somehow did it not work before, I guess I was too confused!. The lending library also was a nice idea thank you all again!

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

Similar Threads

  1. Clear selected value in combo box
    By bbrazeau in forum Programming
    Replies: 6
    Last Post: 08-05-2014, 12:38 AM
  2. Replies: 8
    Last Post: 06-23-2014, 12:19 PM
  3. Replies: 5
    Last Post: 08-30-2012, 06:34 PM
  4. Get combo box selected text.
    By allstar45 in forum Programming
    Replies: 1
    Last Post: 02-16-2012, 10:03 AM
  5. Replies: 1
    Last Post: 03-27-2010, 06:13 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