MS Access 2003 COmbobox and VBA - Selected Item

Larry Brister
Larry Brister used Ask the Experts™
on
My attached code works fine...
But, I've been out of VBA for a while.

When I select an Item, I want to display both columns...not just the bound one.

How do I do that?

Dim cmd1 As New ADODB.Command
Dim rst1 As ADODB.Recordset
'Connect to db and run stored proc based on Client ID
cmd1.ActiveConnection = CurrentProject.Connection
cmd1.CommandType = adCmdStoredProc
cmd1.CommandText = "usp_MarketingVisitationsGet"
cmd1.Parameters("@ClientID") = Me.txtClientID.Value

'Set the recordset
Set rst1 = cmd1.Execute()

With Me.cmbVisits
    .RowSourceType = "Value List"
    .BoundColumn = 1
    .ColumnCount = 2
    .ColumnWidths = ".5in;1.5in"
    .ColumnHeads = False
End With

With rst1
    .MoveFirst
    Do Until .EOF
        cmbVisits.AddItem !id & ";" & !visitStatus
        .MoveNext
    Loop
End With

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Can you attach a sample database? Your code looks fine to me.

Perhaps expand your combo width to see what happens.
Database Architect / Application Developer
Top Expert 2007
Commented:
"I want to display both columns..."
Do you mean after the selection?
You cannot do that - unless you create a concatenated column.

mx
Larry Bristersr. Developer

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial