Results 1 to 7 of 7
  1. #1
    GM02 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2022
    Posts
    2

    Automatic combobox update

    Good morning everyone.
    I have a problem with two comboboxes of one mask.
    The comboboxes are as follows:
    -cbo_1
    -cbo_2


    A certain number of electronic devices can be selected in cbo_1.
    The cbo_2 is "controlled" by the cbo_1 and when an electronic device is selected in the cbo_1 automatically in the cbo_2 there is only the company that sells this electronic device.


    I know that for each electronic device there is only one company, so I would like to make sure that when I select an electronic device in cbo_1, cbo_2 is automatically updated without having to manually select the corresponding company.
    I tried inserting a macro in the "AfterUpdate" event of cbo_1, but cbo_2.Requery is not enough, in fact I have to manually select the company from cbo_2.
    How can I do ?


    Thank you all.
    Sorry for the bad English

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    2,981
    Have a read here on how to set up what is known as Cascading combo boxes:
    http://baldyweb.com/CascadingCombo.htm
    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 ↓↓

  3. #3
    GM02 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2022
    Posts
    2
    hello Minty,
    thank you very much for your answer, I know how to connect two comboboxes, but I would like the second one to select the result by itself.

  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    2,981
    What have you tried?
    If there is only one possible result for combo two then simply bring the value in from the first combo?
    Do you even need the second combo?

    Assuming your 1st combo (I'll call it cboDevices) rowsource is something like

    SELECT ElectronicDevice, SuppplierCompany From YourTables

    In the source control of a second unbound textbox simply put

    = cboDevices.column(1)

    This will display the company automatically.
    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 ↓↓

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,738
    Quote Originally Posted by GM02 View Post
    hello Minty,
    thank you very much for your answer, I know how to connect two comboboxes, but I would like the second one to select the result by itself.
    So lookup how to select a value from the combo list to be the default. In your case it will be from just one entry.
    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

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,615
    If it's a 1 to 1 relationship between device and company, why have 2 controls? Might as well put the company in the second column of one combo?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,734
    Agree with Minty and Micron. Second combobox doesn't make sense. Just a textbox to display associated company.
    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.

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

Similar Threads

  1. Dropdown value automatic update upon selection
    By HansBades in forum Access
    Replies: 2
    Last Post: 06-18-2022, 07:23 PM
  2. Automatic update query
    By jdebiso in forum Queries
    Replies: 10
    Last Post: 04-18-2017, 07:40 AM
  3. Automatic report update
    By gsucin in forum Reports
    Replies: 4
    Last Post: 10-27-2016, 01:04 PM
  4. Replies: 1
    Last Post: 04-08-2014, 09:35 AM
  5. ComboBox to ComboBox automatic fill
    By vbjohn in forum Access
    Replies: 2
    Last Post: 08-18-2011, 01:35 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