Results 1 to 10 of 10
  1. #1
    eugzl is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2021
    Posts
    68

    how to change ComboBox rowsource based on condition

    Hi All.
    In child form I have cascade combo boxes. They work fine in case if I open that form to create new record. But if i try to use this form to modify existing record I met the problem. In the form last level of cascade combo boxes is bound and should be populated but rowsource of the combobox has criteria and that not allow to display data. When I remove criteria of cause cascade combo box stop working but in that case it display value of record passed from parent form to modify the record.
    How to dynamically change rowsource of combobox:
    1. if I open form to create new record then I will use query as rowsource for combobox with criteria
    2. if I open form to modify existing record then I will use query as rowsource for combobox without criteria



    I will appreciate if someone will show how to do it.
    Thanks

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    @eugzi
    Is this the same topic as https://www.accessforums.net/showthread.php?t=85132?
    If yes, then no need to start a new thread.
    If no, please tell us what is different.

  3. #3
    eugzl is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2021
    Posts
    68
    Hi orange. Thanks for reply.
    Yes, It is the same topic. I thought that for different question I must open new thread.

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    ?? I'm still not sure of what your business need is?? I know you have some code and some strategy in mind, but I'm not understanding.

    Typically you would have a form for data entry, some event processes to validate the data entered and ensure required fields were valued. You would store those records in a table(s). If there was need for further review or adjustment, you would use the table as the recordsource of a form to do such revisions.

    How would you know what to change in the combobox rowsource? If you can tell us and show some examples, I'm sure someone will offer advice.

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Also not quite sure what the final goal is, but to do what you describe you can use the Enter or GotFocus event of that combo and test for Me.NewRecord=True and set the combo's row source accordingly :

  6. #6
    CarlettoFed is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2019
    Posts
    255
    If you had read the post # 12 of the security "problem to populate child form", also created by you, you would have already solved the problem.

  7. #7
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    @eugzl

    1. Please describe your requirement in simple, plain English. Keep the description free of database jargon. The plain, English description identifies WHAT is required. The database terms/jargon represents HOW you have done the implementation. We
    have to understand what in order to offer advice/options for how.

    2.Review and try CalettoFed's suggestion. Tell us your results.

    3. If you have required/compulsory fields, then you should address that in you data entry process and/or table field properties.
    Last edited by orange; 01-14-2022 at 10:56 AM.

  8. #8
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

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

  10. #10
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Repeat offender. It is why OP is on my ignore list. I have too many ways to waste time as it is.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Set rowsource of combobox
    By diegomarino in forum Access
    Replies: 4
    Last Post: 11-28-2020, 10:16 AM
  2. Combobox filtered rowsource?
    By TerraEarth in forum Access
    Replies: 4
    Last Post: 04-03-2018, 02:28 PM
  3. Change an image on a form based on a combobox
    By jessehiggins in forum Database Design
    Replies: 3
    Last Post: 02-21-2014, 04:31 PM
  4. Change fields based on a combobox click
    By Richie27 in forum Programming
    Replies: 5
    Last Post: 05-31-2012, 08:01 AM
  5. combobox rowsource
    By dirkvw in forum Forms
    Replies: 3
    Last Post: 06-20-2011, 05:12 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