Results 1 to 4 of 4
  1. #1
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051

    Combo boxes

    I have 20 combo boxes on a form from where users choose topics for tbltopics or add topics to the same table. They choose from every combo box. Some will be added, some will need to be added to tbltopics.



    Anyone any idea how I can use the same code for all the comboboxes with as little code as possible? I don't really want to have to run similar code from every combo box

    I've read up on the notInList event but it seems inflexible for multiple combo boxes.





    Sent from my iPhone using Tapatalk

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    I've read up on the notInList event but it seems inflexible for multiple combo boxes.
    In what way? I would have thought that it was ideal for catching data that needs to be added to the table. Should be possible to create a sub or function that can be called in the event to add to the table.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    The issue here is that I'd like to do 2 things with each combo.

    If cbotopicx (where x is integer from 1-20) is "fractions" and fractions is not in the list I need to add it to tbltopics (that's easy part)

    I then need to add the topicId from tbltopics to the field topicx (again x is from 1-20) in the tblexams table.

    This is the bit that's stressing me as I can't use the not in list event to pull the combo name over


    I don't want an almost identical code for each combo if I can help it.
    Hope this makes sense.



    Sent from my iPhone using Tapatalk

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Can you post a copy of the database --remove anything private/confidential first?
    You are telling us HOW (20 comboboxes) you have done something. There may be options if we knew WHAT you are trying to solve/automate.

    I don't really want to have to run similar code from every combo box
    Why not?

    You can build 1 combo, then use some code to copy/edit that skeleton to make 20 or 200....
    The secret is to identify the real need, resolve a specific instance, then generalize/expand to meet your requirement.
    Good luck.

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

Similar Threads

  1. Replies: 5
    Last Post: 09-22-2016, 08:42 AM
  2. Changing text boxes to combo boxes
    By Lou_Reed in forum Access
    Replies: 8
    Last Post: 09-15-2015, 11:09 AM
  3. Linking Combo boxes and Text boxes
    By Nathan4477 in forum Forms
    Replies: 6
    Last Post: 07-29-2015, 08:50 AM
  4. Replies: 11
    Last Post: 08-06-2014, 09:47 AM
  5. Replies: 9
    Last Post: 06-04-2014, 10:45 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