Results 1 to 10 of 10
  1. #1
    StevieJD is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2018
    Posts
    4

    Lookup Wizard to Grandparent Parent Record

    I'm trying to teach myself how to create databases in Microsoft Access. Unfortunately I have no one else to ask so I'm hoping that some kind person on this site will be able to help me?

    I have thought up a fictitious Cleaning company which providers cleaning services to many different business clients. Each client will have many different sites and each site will need two (or more) cleaners.

    I am comfortable in creating a one to many (parent / child) relationship, using the Lookup Wizard, between Client and site, so that when I populate the site table, I can lookup the Client from a drop down list. Like wise, when I assign a cleaner to a site, I can assign a cleaner to a site but looking up the site from


    cleaner table.

    However, eventually what id like to be able to do is select a cleaner, then assign the cleaner to the site, by using the lookup dropdown list (which I can already do), and then select Client from another drop down list without leaving the cleaner table / form.

    Conversely, in a form, when assigning cleaners to sites, I also like to be able to select a Client, then select all the Sites the client has , and THEN select a list of cleaners so I can assign two or more Cleaners to the site, again using lookup drop downs.

    I believe this will require a Grandparent \ Parent \ Child relationship. Can I use the lookup wizard to accomplish this, and if so how?

    Thanks in advance for your help.

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Use three cascading combo boxes where the combo sql for the second (sites) depends on the client value from the first combo.
    Similarly the cleaner combo sql will depend on the site value from the second combo.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    so that when I populate the site table, I can lookup the Client from a drop down list
    this sounds like you are using lookups in your table design. Although this can be done it is not a good idea as it will lead to confusion. See these links http://access.mvps.org/access/lookupfields.htm, https://bytes.com/topic/access/answe...-lookup-fields. Lookups (combo or listbox) are fine in a form.

    However, eventually what id like to be able to do is select a cleaner, then assign the cleaner to the site, by using the lookup dropdown list (which I can already do), and then select Client from another drop down list without leaving the cleaner table / form.
    if you have assigned a site to a cleaner, why do you need to assign the client as well? that is already covered when you assigned sites to clients


    also like to be able to select a Client, then select all the Sites the client has , and THEN select a list of cleaners so I can assign two or more Cleaners to the site, again using lookup drop downs.
    Really think you need to think your design through in more detail - what if you have assigned a cleaner to 20 sites already and they don't have time for this one? what if cleaner2 is not available at the same time as cleaner1? What happens when a cleaner is ill or on holiday?

    From your description you need a minimum of four tables

    Clients
    Sites
    Cleaners
    Cleaner/Site assignments

    and you need to manage these using forms and subforms, not lookups in a table

  4. #4
    StevieJD is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2018
    Posts
    4
    Thank you ridders, I'll think about this.

  5. #5
    StevieJD is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2018
    Posts
    4
    Thanks for the links Ajax - very, very useful.

    It looks like I've got some more thinking to do!

  6. #6
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Agree with Ajax about table structure. However my original advice may still be relevant.
    Whilst you're rethinking your design, have a look at this example of cascading combo boxes http://www.fmsinc.com/MicrosoftAcces...cascading.html
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  7. #7
    StevieJD is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2018
    Posts
    4
    Once again, thank you very, very much.

    I've limited experience of Access VBA, but I can usually get Excel VBA to do what I want it to, so this will be a very interesting and useful challenge!

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    @Ridders - there are some problems with that example

    a) only works on single forms
    b) advice is wrong - no need to requery if you update a rowsource
    c) however you do requery the rowsource if the rowsource is written like this

    "SELECT PhylumID, PhylumName " & _
    "FROM tblPhylum " & _
    "WHERE KingdomID = [cboKingdomID] " & _
    "ORDER BY PhylumName"

    also there is a missing space in the example WHERE line. Bit sloppy for FMS

  9. #9
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Quote Originally Posted by Ajax View Post
    @Ridders - there are some problems with that example

    a) only works on single forms
    b) advice is wrong - no need to requery if you update a rowsource
    c) however you do requery the rowsource if the rowsource is written like this

    "SELECT PhylumID, PhylumName " & _
    "FROM tblPhylum " & _
    "WHERE KingdomID = [cboKingdomID] " & _
    "ORDER BY PhylumName"

    also there is a missing space in the example WHERE line. Bit sloppy for FMS
    Apart from all that, is it ok????

    I have to admit I'd only looked at the FMS example without ever testing it.
    Perhaps should have uploaded an example of my own!
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  10. #10
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938

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

Similar Threads

  1. Lookup Wizard Help
    By bonnepoutine in forum Access
    Replies: 1
    Last Post: 05-24-2018, 12:33 PM
  2. Lookup Wizard
    By JennyL in forum Access
    Replies: 3
    Last Post: 01-23-2017, 01:42 PM
  3. lookup wizard help
    By Delta729 in forum Access
    Replies: 1
    Last Post: 01-01-2015, 02:22 PM
  4. LOOKUP WIZARD, is it possible?
    By finsmith in forum Programming
    Replies: 5
    Last Post: 01-24-2013, 09:45 AM
  5. lookup wizard
    By dafdek in forum Access
    Replies: 1
    Last Post: 01-10-2013, 04:57 PM

Tags for this Thread

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