Results 1 to 4 of 4
  1. #1
    Glenn_Suggs is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    72

    Arrow Referencing specific column in combo box

    Hi Folks,

    Here is a situation that I came across that really threw me for a loop. (No pun intended) I'm trying to reference a column in a combo box using this format:

    Code:
    For Ctr = 1 to 10
        SomeField = Me("cboFieldName" & Format(Ctr,"00"))
        Process the data here
    Next Ctr
    where the code is looping through several combo boxes and processing each in turn. So the combo boxes are named like this:
    cboFieldName01, cboFieldName02, etc.

    Does anyone know of a way to reference a specific column in the combo box using this format? All I need is the syntax (If there is one for this.) If I can't find a way to do it, I'm afraid I'll have to re-write a whole bunch of code that really works great otherwise. Then I'll be changing all the references to use this:
    Me.cboFieldName01.Column(0), Me.cboFieldName02.Column(1), etc.

    Thanks in advance,


    Glenn

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    You appear to be on right track.

    Me("cboFieldName" & Format(Ctr,"00")).Column(1)

    This assumes the value you want for each combobox is in the same column position.
    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.

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    to add to June's comments, columns start from 0, so column(1) is the second column

  4. #4
    Glenn_Suggs is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    72
    Thanks, June... That does work great. I thought I had tried that syntax actually but maybe I got one of the parenthesis out of place. Anyway, thanks for the help.

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

Similar Threads

  1. Code for referencing a specific object in a collection of forms
    By ReliabilityDave in forum Programming
    Replies: 2
    Last Post: 04-03-2018, 03:44 PM
  2. Replies: 5
    Last Post: 05-31-2017, 08:58 AM
  3. Replies: 18
    Last Post: 05-07-2015, 10:59 AM
  4. Replies: 3
    Last Post: 03-29-2013, 02:36 PM
  5. Using a combo box to populate a specific column
    By MHernan1 in forum Programming
    Replies: 1
    Last Post: 08-28-2012, 05:29 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