Go to specified row of a combo box with check boxes

On MS Access 2007 my combo box allows multiple selections, providing check boxes for the selections.  How can I allow user to quickly go to a desired row of the combo box? --e.g., go to the rows of the field that begin with letter "P"? ( This is not a problem with a simple combo box that doesn't allow multiple sections; you put the curser in a row of the field, and enter the first letter of the first word in the field.) I have attached a Word picture of the opened combo box. GOTO-desired-row-of-a-combo-box.docx
Tucker22Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

omgangIT ManagerCommented:
One option is to add a new first column to the combo box row source.  Make it the same as the current second column.  You'll have that column included twice.  Set the column width for the first column to 0.01" or something.  Make sure to adjust the bound column setting so it is still on the column you want.
OM Gang
Tucker22Author Commented:
This would not allow me to use the "Allow Multiple Values" property for the combo box (with check boxes to select the values), and move to the desired row by entering the first letter of that row's text value.
omgangIT ManagerCommented:
Please post the row source for the combo box in question.
OM Gang
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Jeffrey CoachmanMIS LiasonCommented:
This is what I would consider yet another drawback to using these "Multi Valued fields"
http://allenbrowne.com/Access2007.html#Mixed

Even though the Autoexpand property is set to yes, this does not seem to work because the checkbox seems to always be the first visible column (what the autoexpand property usually picks up on)

The theory being, if you are going to use multiselect fields, then you want to select more than 1 Value,
...hence, no need to "Jump" to a value like you can in a "Single" value filed" (standard combobox).


JeffCoachman

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tucker22Author Commented:
To Omgang: Thank you for trying to help; maybe you will have a further suggestion.  Here is the row source:

SELECT [LkUpPart63MACTReq].[Part63_subpart_short_name], [LkUpPart63MACTReq].[MajorArea] FROM [LkUpPart63MACTReq];

I had already combined the original two fields--the field having "A" to "ZZZZ" values with the field that is the "short name" of the Subpart.  I did this because I wanted the combo box selections to update the associated table with both of these values, and selections from a combo box can populate only one field of a table--as far as I know.

 I might give up on allowing multiple selections from this particular  combo box (which has long rows of text, as it seems to adversely affect (1) selecting options , and (2) the readability of the values when they are placed in one field.  But maybe you will have another suggestion that works well.
omgangIT ManagerCommented:
<<and selections from a combo box can populate only one field of a table--as far as I know.>>
Not so.  It's true that a combo box can have only one bound column that can be assigned to a field in the underlying table.  However, there is nothing to stop us from populating many other table fields (via code, macro, etc.) with the values from the other columns in the combo box.  In general we don't do this becuase the it goes against normalization:  if we can store one value in a table and lookup related values from other tables (or via calculation) then we should only store the single value in our table.
OM Gang
omgangIT ManagerCommented:
Tucker22, I can't figure it out either.  I have never used multi valued fields and am thinking boag2000 is on to it for why this doesn't work.  Here's what I've tried and it functions as expected up to the point of trying to set focus onto an item in the list.  Each approach I attempt results in an error.


Option Compare Database
Option Explicit

Public blKeyPressed As Boolean

Private Sub Category1_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo Err_Category1_KeyDown

    Dim i As Integer
    Dim x As String
    Dim vVal As Variant
   
    blKeyPressed = False
   
        'check value of public key press variable an only proceed if it is False
    If blKeyPressed = True Then GoTo Exit_Category1_KeyDown
   
        'capture key press character
    x = Chr$(KeyCode)
   
    For i = 0 To Me.Category1.ListCount - 1
        If Left(Me.Category1.ItemData(i), 1) = x Then

            'Me.Category1.ItemData(i).Select
       
            'vVal = Me.Category1.ItemData(i).Column(0)
       
            'Me.Category1.ItemData(i).SetFocus
           
            'vVal = Me.Category1.ItemData(i)
            'Me.Category1.Value = vVal        
   
            Exit For
        End If
    Next

        'set public key press variable to true so we don't repeat this for every key press
    blKeyPressed = True
   
Exit_Category1_KeyDown:
    Exit Sub

Err_Category1_KeyDown:
    MsgBox Err.Number & ", " & Err.Description, , "Error in Sub Category1_KeyDown of VBA Document Form_frmCategory"
    Resume Exit_Category1_KeyDown
End Sub
Tucker22Author Commented:
Thanks to OM Gang & Jeff Coachman.  Your comments convinced me to create multiple combo boxes rather than allowing multiple entries to one combo box.  It's a less sophisticated method and takes up more space on the form, but it'll be easy for users to enter data and the design can be easily maintained.
Jeffrey CoachmanMIS LiasonCommented:
To be fair, ...yes the Multiselect value/field/combobox is slick...

But remember, it has real flaws:
http://allenbrowne.com/Access2007.html#Mixed
http://support.microsoft.com/kb/926701

IMO, the biggest draw back is that it glosses over one the most crucial relationships in database design, ...The Many-to-Many relationship.

By doing this it shortchanges new Access developers of this critical skill.

Remember, if you rely to heavily on MVF's, and do not learn these basic concepts, you will be at a distinct disadvantage when it comes time to upgrade to SQL Server.
As of now, these MVF's *DO NOT* import into SQL Server.
So you may have to  redesign key parts of your application all over again from scratch.

Finally keep in mind that Database professionals have been successfully designing these types of relationships and interfaces for over 50 years, ...long before MVF's in MS Access.


;-)

JeffCoachman
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.