Results 1 to 9 of 9
  1. #1
    carterlangley is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Rothienorman, Scotland
    Posts
    15

    Query for a Combo Box

    Hi everyone,



    I have two tables, Organisation and Division. One to many relationship (one organisation can have many divisions).
    On the organisation form, there is a combo box to select the divisions associated with that organisation. What I'm finding is getting me very confused.

    I have an organisation, Aberdeenshire Council, and about 20 other organisations all different. When I drop the combo box down for an organisation which doesn't have any divisions listed in the division table for that organisation, I am getting the divisions listed for Aberdeenshire Council. All the other organisations which also don't have division details listed in the division table also display the divisions for Aberdeenshire Council.

    Can somebody please explain to me what I have done wrong?

    Organisation Table
    Organisation ID autonumber primary
    OrganisationName

    Division Table
    DivisionID autonumber primary
    OrganisationID (Lookup option used to establish query)
    DivisionName

    underlying query in the combo box
    Code:
    SELECT [Division].[DivisionID], [Division].[OrganisationID], [Division].[Division] FROM Division ORDER BY [Division];
    Something here is just not looking right. I'm not a programmer, so I can't quite place it but something there doesn't seem right

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    when you look at the table tDivision ,does it have [OrganisationID] values?
    if you have a form, and pick the combo box for Organisation , the combo box must be bound to the 1st column [OrganisationID]
    now that you have that ID, you can filter (the records, or the form) based on that value.

    SELECT [Division].[DivisionID], [Division].[OrganisationID], [Division].[Division] FROM Division where [[OrganisationID]=forms!myForm!cboOrg

    then it will show only those divisions based on the ID in the combo box.

  3. #3
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    It sounds like you need or are needing cascading combo boxes - Paul has an excellent guide here; http://www.baldyweb.com/CascadingCombo.htm
    With a small demo database included.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #4
    carterlangley is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Rothienorman, Scotland
    Posts
    15
    Hi ranman,

    Tried that, but I can't seem to get it working. I've exported the table information into a text document. Is there anyway I can get that over to you so you can have a look?
    I can do the same with the relationships if that will help?

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    post the database so we can see.
    (use the MANAGE ATTACHMENTS button at the bottom of screen)

  6. #6
    carterlangley is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Rothienorman, Scotland
    Posts
    15
    Database size exceeds the forum limit :-(
    Database is just over 1 meg in size at the moment.
    It also has a hell of a lot of personal information. I'm my wife's full time carer and I'm trying to do this database to keep a record of medication usage and toilet routines and paramedic visits and hospital admissions, etc.

  7. #7
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Make a copy of the database, delete all tables except the two that are in question here. Compact and Repair it, the zip it. That will bring it down to size.

  8. #8
    carterlangley is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Rothienorman, Scotland
    Posts
    15
    Hi aytee111,

    I've emailed a copy of the database as it currently stands to ranman256. I'll see if I can zip it and then post it.

  9. #9
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    If he is helping then don't worry!

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

Similar Threads

  1. Replies: 5
    Last Post: 09-22-2016, 08:42 AM
  2. Replies: 5
    Last Post: 07-28-2014, 04:05 PM
  3. Replies: 3
    Last Post: 03-04-2014, 03:54 PM
  4. Replies: 19
    Last Post: 08-25-2011, 10:54 AM
  5. Replies: 4
    Last Post: 08-16-2011, 05:54 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