Results 1 to 12 of 12
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,371

    Adding My Own Option In Combo

    Hi gGuy's unsure if this is possible



    I have a combo set to table/query listing a fields from a table

    There are various combos throughout the database using the same option

    There is one particular combo where i was thinking of adding a sporadic option (just as if it was a value list)

    If i were to do this, i don't want other combos having this chosen option

    Otherwise the easiest way i guess is top add a record to the bound table

    I have thought of adding a yes/no field called ListDisplay but this means updating the list per combo before update or on got focus

    Is there a method of adding a unique option to just 1 x combo ?

    I don't think there is but you guys on here may confirm

  2. #2
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,371
    After thought unless any advice beforehand

    i guess, copy my table and rename and add the unique option to table2 and set the desired combo to table2 and leave all other combos as table one

    is this efficient to my question ?

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    For that one errant combo, turn it into a value list combo instead, and populate from your table plus your extra 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

  4. #4
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,880
    There is one particular combo where i was thinking of adding a sporadic option (just as if it was a value list)
    What do you mean by sporadic? Is it that this 1 combo will only sometimes have the extra option and sometimes not? How many columns are in the combo?
    Do you also need a primary key for this added option?

    One way I limit what's in a combo is to add a where clause with either an "ID <> somevalue" or I use a "Where ID not in( 1,3,4,7)" to limit what's returned.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  5. #5
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,371
    Hi WGM and Moke123, i meant by adding a unique value to a combo that is bound to table

    I don't have a primary key in this particular table but that is probably best based on Moke123 suggestion

    Add a new auto number field and add a clause where the combo is populated where ID Not(number of record)

    I will give that a try

    Thank you

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    Well how many combos do you have already?, as you will need to modify all of them except the errant one.?
    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

  7. #7
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,371
    There are only about 6 or 7 using the same data from the same table, this table is only updated quite occasional as its storing brands of products and not daily updating

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    Thinking a bit more about this Dave.

    I would go for a new field in that table that states whether the entry is regular or not.?
    Then in most of your combos only select those that are regular, and for the errant one select everything. You could even have a date field that says whether they are still in use or not.
    That way if you have yet another errant entry, you do not have to change the code, whereas with IN() you would?

    Make sense?
    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

  9. #9
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,371
    Thanks WGM, yes all makes sense, sorry had to dash last night so back to it now:

    Totally makes sense to me, I could have something a text field called Display, update all to Yes (the word Yes) then remove the word Yes out of specific records, i guess this would do the trick

    Then tell the combo Where Is NULL(Display) from tbl etc....

    Thanks again WGM............

    By the way i must confess from a previous post, I NOW PRESS SAVE EVERYTIME I WORK ON ANY DATABASES

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    Well I honestly would make the field boolean.

    Then I could just have

    Select field1, field 2 from table where Display is True for all the standard combos
    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

  11. #11
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,371
    Yes i think in one of my earlier posts of have a yes/no field

    Thanks for your input

    Kindest

  12. #12
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,880
    I wouldn't rely on doing updates to a boolean field. Why have more moving parts than what is needed.

    I would just add the value to the table and adjust the rowsource to include or exclude the unwanted values.

    For instance you have a table with 5 records and only want 4 in the combo. Just add <>5 in the criteria to exclude the record with a pk of 5.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

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

Similar Threads

  1. Combo Box Wizard does not have option form option
    By CementCarver in forum Forms
    Replies: 5
    Last Post: 02-28-2013, 08:54 PM
  2. Adding option within a frame
    By crowegreg in forum Forms
    Replies: 1
    Last Post: 09-11-2012, 01:51 PM
  3. Adding "ALL" option to combo box
    By nic311 in forum Forms
    Replies: 6
    Last Post: 11-16-2011, 01:55 PM
  4. Replies: 3
    Last Post: 10-25-2011, 11:38 PM
  5. Replies: 1
    Last Post: 05-05-2011, 09:21 AM

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