Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    Sep 2021
    Posts
    13

    Cascading Combo box on s subform

    Hello,



    I assume there is probably and answer to my question somewhere on this forum but I must not know how to find it. I'm sorry if I'm posting the same question somebody else has already put on here.

    I have two combo boxes accountID and subaccountID on a sub form that are both based on tables in a one to many relationship. I want to be able to select a value in the accountID combo box and then have the subaccountID combo box update to reflect the related records in the accountID field. How do I accomplish this? Do I put an expression in the select query on which the row source is based?

    I hope my question makes sense. If it's been asked already point me to the related posts.

    This YouTube video shows what I want to do, but just on a sub form.

    https://www.youtube.com/watch?v=at0uaGSnUco

    Thanks,

    Joel
    Last edited by wheatlandacctech; 05-21-2022 at 04:02 PM.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Example here that may be helpful.
    If not, then post your code to the forum.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    Join Date
    Sep 2021
    Posts
    13
    Thanks for your reply.

    I have two tables, one called Accounts with a primary key of accountID and the other one SubAccounts with a primary key of subaccountID and a foreign key of accountID relating it to the accounts table. I then have a main form called Accounts and a subform called SubAccounts. I have two combo boxes on the sub form named accountID and subaccountID. The subaccountID combo box's row source is a select query which has a column for the accountID. In the query on which the row source is based, I have the following code in the criteria row of the accountID column.

    [Forms]![frmSubAccount]![accountID]

    I don't know if I've given to much information or not enough, but that is the layout of what I've got set up. The crazy thing is that it works fine when I just open of the subform but it won't work as a subform. Where do I go from here?

    Thanks,

    Joel

  5. #5
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,778
    @WGM - does the link work for you?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Join Date
    Sep 2021
    Posts
    13
    No, I couldn't get it to work for me.

    Joel

  7. #7
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,778
    I have a feeling that you're missing the bigger picture. Why people don't seem to post the below link very much any more (and I'm not saying it's just responders here) might be due to just plain being fed up. Anyway, here you go

    https://www.excelguru.ca/content.php?184
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,563
    Hi Joel

    Remember in the AfterUpdate of the Account Combobox to use:-

    Me.cboSubaccountComboboxname.Requery


    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    Quote Originally Posted by Micron View Post
    @WGM - does the link work for you?
    Yes, that is just a link to a search for the O/P posts which shows he crossposted within AWF. Take your pick of which one to look at.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  10. #10
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,778
    Quote Originally Posted by Welshgasman View Post
    Yes, that is just a link to a search for the O/P posts which shows he crossposted within AWF. Take you pick of which one to look at.
    Did you try it from your post? This is what I get

    Oops! We ran into some problems.

    The requested page could not be found.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  11. #11
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    Quote Originally Posted by Micron View Post
    Did you try it from your post? This is what I get

    Oops! We ran into some problems.



    The requested page could not be found.
    Yes, I used the link from my post.
    Just done so again and I get to see the pic attached.?

    Perhaps you need to be logged in?
    Attached Thumbnails Attached Thumbnails wheat.PNG  
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  12. #12
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,778
    Perhaps you need to be logged in?
    That would be it. Kind of makes following it a problem for anyone who's not logged in there or isn't even a member.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  13. #13
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    Quote Originally Posted by Micron View Post
    That would be it. Kind of makes following it a problem for anyone who's not logged in there or isn't even a member.
    TBH, I did not realise?

    From now on, I will just link to the crosspost or just one of them, if more than one

    O/P is a menber though, and unlike UA, you do not get kicked off every 10 seconds.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  14. #14
    Join Date
    Sep 2021
    Posts
    13
    Yes, I have the AfterUpdate of the Account combobox. All I need is for someone to tell me the correct syntax to reference a control in a subform. I know someone has probably already answered that but I can't find it.

    Thanks,

    Joel

  15. #15
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    Quote Originally Posted by wheatlandacctech View Post
    Yes, I have the AfterUpdate of the Account combobox. All I need is for someone to tell me the correct syntax to reference a control in a subform. I know someone has probably already answered that but I can't find it.

    Thanks,

    Joel
    http://access.mvps.org/access/forms/frm0031.htm
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Cascading combo on subform (WHERE) Clause
    By d9pierce1 in forum Programming
    Replies: 15
    Last Post: 02-03-2021, 12:44 PM
  2. Cascading Combo Box on Form to Subform?
    By d9pierce1 in forum Programming
    Replies: 14
    Last Post: 12-08-2020, 11:34 AM
  3. Cascading Combo Box and Subform Issues
    By RossIV in forum Forms
    Replies: 13
    Last Post: 07-18-2013, 09:16 AM
  4. Cascading Combo in SubForm
    By ggs in forum Forms
    Replies: 1
    Last Post: 02-16-2012, 01:32 AM
  5. cascading combo boxes in continuous subform
    By ayamali in forum Programming
    Replies: 1
    Last Post: 03-29-2011, 06:33 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